20241126更新
parent
1e5b68bf0a
commit
2e6d71c92e
@ -0,0 +1,152 @@
|
||||
package com.currency.appengine.service.export.model;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 队伍信息
|
||||
*/
|
||||
@Data
|
||||
public class OrderTrackingExport {
|
||||
|
||||
@Excel(name = "销售订单号", width = 40)
|
||||
private String salesOrderCode;
|
||||
|
||||
@Excel(name = "订单号", width = 40)
|
||||
private String orderNo;
|
||||
|
||||
@Excel(name = "产品编码", width = 40)
|
||||
private String materialCode;
|
||||
|
||||
@Excel(name = "物料名称", width = 40)
|
||||
private String materialName;
|
||||
|
||||
@Excel(name = "型材型号", width = 40)
|
||||
private String profileModel;
|
||||
|
||||
@Excel(name = "规格型号", width = 40)
|
||||
private String specification;
|
||||
|
||||
@Excel(name = "壁厚", width = 40)
|
||||
private String thickness;
|
||||
|
||||
@Excel(name = "米重 (kg/m)", width = 40)
|
||||
private String weight;
|
||||
|
||||
@Excel(name = "订单总数 (支)", width = 40)
|
||||
private String orderLength;
|
||||
|
||||
@Excel(name = "订单长度 (M)", width = 40)
|
||||
private String orderTotalQuantity;
|
||||
|
||||
@Excel(name = "表面方式 (颜色)", width = 40)
|
||||
private String surfaceMethod;
|
||||
|
||||
@Excel(name = "订单日期", width = 40)
|
||||
private String deliveryDate;
|
||||
|
||||
@Excel(name = "理论重量 (KG)", width = 40)
|
||||
private String theoreticalWeight;
|
||||
|
||||
@Excel(name = "生产支数", width = 40)
|
||||
private String producedPieces;
|
||||
|
||||
@Excel(name = "生产长度 (m)", width = 40)
|
||||
private String producedLength;
|
||||
|
||||
@Excel(name = "计划支数", width = 40)
|
||||
private String plannedPieces;
|
||||
|
||||
@Excel(name = "排产长度", width = 40)
|
||||
private String productionLength;
|
||||
|
||||
@Excel(name = "排产支数", width = 40)
|
||||
private String productionPieces;
|
||||
|
||||
@Excel(name = "锯切方式", width = 40)
|
||||
private String sawingMethod;
|
||||
|
||||
@Excel(name = "实际米重", width = 40)
|
||||
private String jiya_productionWeight;
|
||||
|
||||
@Excel(name = "已挤压支数", width = 40)
|
||||
private String jiya_productionNumber;
|
||||
|
||||
@Excel(name = "已挤压重量(KG)", width = 40)
|
||||
private String jiya_actualWeight;
|
||||
|
||||
@Excel(name = "已精品支数", width = 40)
|
||||
private String jingpin_productionNumber;
|
||||
|
||||
@Excel(name = "已精品重量(KG)", width = 40)
|
||||
private String jingpin_productionWeight;
|
||||
|
||||
@Excel(name = "已氧化上排支数", width = 40)
|
||||
private String yanghau1_productionNumber;
|
||||
|
||||
@Excel(name = "已氧化上排重量(KG)", width = 40)
|
||||
private String yanghau1_actualWeight;
|
||||
|
||||
@Excel(name = "已氧化下排支数", width = 40)
|
||||
private String yanghua2_productionNumber;
|
||||
|
||||
@Excel(name = "已氧化下排重量(KG)", width = 40)
|
||||
private String yanghua2_actualWeight;
|
||||
|
||||
@Excel(name = "已精切支数", width = 40)
|
||||
private String jingqie_productionNumber;
|
||||
|
||||
@Excel(name = "已精切重量(KG)", width = 40)
|
||||
private String jingqie_actualWeight;
|
||||
|
||||
@Excel(name = "已打孔支数", width = 40)
|
||||
private String dk_productionNumber;
|
||||
|
||||
@Excel(name = "已打孔重量(KG)", width = 40)
|
||||
private String dk_actualWeight;
|
||||
|
||||
@Excel(name = "已包装支数", width = 40)
|
||||
private String bz_productionNumber;
|
||||
|
||||
@Excel(name = "已包装重量(KG)", width = 40)
|
||||
private String bz_actualWeight;
|
||||
|
||||
@Excel(name = "入库支数", width = 40)
|
||||
private String receiptQuantity;
|
||||
|
||||
@Excel(name = "已入库重量(KG)", width = 40)
|
||||
private String actualWeight;
|
||||
|
||||
@Excel(name = "交货支数", width = 40)
|
||||
private String shipmentQuantity;
|
||||
|
||||
@Excel(name = "已交货重量(KG)", width = 40)
|
||||
private String shipmentActualWeight;
|
||||
|
||||
@Excel(name = "未交货支数", width = 40)
|
||||
private String noShipmentQuantity;
|
||||
|
||||
@Excel(name = "未交货重量(KG)", width = 40)
|
||||
private String noActualWeight;
|
||||
|
||||
@Excel(name = "库存总支数", width = 40)
|
||||
private String existingInventory;
|
||||
|
||||
@Excel(name = "库存总重量(KG)", width = 40)
|
||||
private String existingActualWeight;
|
||||
|
||||
@Excel(name = "长料报废支数", width = 40)
|
||||
private String longScrapNumber;
|
||||
|
||||
@Excel(name = "长料报废重量(KG)", width = 40)
|
||||
private String longScrapWeight;
|
||||
|
||||
@Excel(name = "短料报费支数", width = 40)
|
||||
private String shortageScrapNumber;
|
||||
|
||||
@Excel(name = "短料报费重量(KG)", width = 40)
|
||||
private String shortageScrapWeight;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "01a85821982944e8855e0cb8d3d48c72",
|
||||
"name" : "导出",
|
||||
"type" : "api",
|
||||
"parentId" : "c6ba5ea7aca143ef95dffaf14b4960e5",
|
||||
"path" : "/export",
|
||||
"createTime" : 1732603484379,
|
||||
"updateTime" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ec8de9306e07460eb7f04f43b5e7edcf",
|
||||
"script" : null,
|
||||
"groupId" : "01a85821982944e8855e0cb8d3d48c72",
|
||||
"name" : "挤压排产单导出",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732611077461,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/extrusionSchedule",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
import 'exportDataPageServiceImpl' as exportDataPageServiceImpl;
|
||||
|
||||
import '@/sql/extrusionSchedule/count' as masterFind;
|
||||
import response
|
||||
|
||||
int count = masterFind(body);
|
||||
|
||||
body['page'] = 1
|
||||
body['size'] = 100;
|
||||
exportDataPageServiceImpl.magicExport(count, body, "com.currency.appengine.service.export.model.ExtrusionScheduleExport", '/sql/extrusionSchedule/list', '挤压排产', '挤压排产', '挤压排产');
|
||||
|
||||
response.end();
|
@ -0,0 +1,36 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "914ca6c8b3ae43e3ae6029318edff17c",
|
||||
"script" : null,
|
||||
"groupId" : "01a85821982944e8855e0cb8d3d48c72",
|
||||
"name" : "订单跟踪导出",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732610997776,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/orderTracking",
|
||||
"method" : "POST",
|
||||
"parameters" : [ ],
|
||||
"options" : [ ],
|
||||
"requestBody" : "",
|
||||
"headers" : [ ],
|
||||
"paths" : [ ],
|
||||
"responseBody" : null,
|
||||
"description" : null,
|
||||
"requestBodyDefinition" : null,
|
||||
"responseBodyDefinition" : null
|
||||
}
|
||||
================================
|
||||
import 'exportDataPageServiceImpl' as exportDataPageServiceImpl;
|
||||
|
||||
import '@/sql/orderTracking/count' as masterFind;
|
||||
import response
|
||||
|
||||
int count = masterFind(body);
|
||||
|
||||
body['page'] = 1
|
||||
body['size'] = 100;
|
||||
exportDataPageServiceImpl.magicExport(count, body, "com.currency.appengine.service.export.model.OrderTrackingExport", '/sql/orderTracking/list', '订单跟踪表', '订单跟踪表', '订单跟踪表');
|
||||
|
||||
response.end();
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,14 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "753fe736c4d7438090c366180c352d95",
|
||||
"name" : "挤压排产",
|
||||
"type" : "function",
|
||||
"parentId" : "414d04bbdc2e4cb5a23145a0bfe0e649",
|
||||
"path" : "extrusionSchedule",
|
||||
"createTime" : 1732610226287,
|
||||
"updateTime" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "7f8e4140006446d28b625fcb7aa6b967",
|
||||
"script" : null,
|
||||
"groupId" : "753fe736c4d7438090c366180c352d95",
|
||||
"name" : "挤压排产列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732611845401,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/list",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ ]
|
||||
}
|
||||
================================
|
||||
import '@/common/sql' as sql
|
||||
|
||||
String salesOrdeSelect = sql("salesOrder")
|
||||
String scheduleNumber = body["scheduleNumber"];
|
||||
String salesOrderCode = body["salesOrderCode"];
|
||||
String orderNo = body["orderNo"];
|
||||
String materialCode = body["materialCode"];
|
||||
String profileModel = body["profileModel"];
|
||||
String salesStatus = body["salesStatus"];
|
||||
|
||||
String extrusionDate = body['extrusionDate'];
|
||||
String customerId = body['customerId'];
|
||||
String surfaceMethod = body['surfaceMethod'];
|
||||
|
||||
var list = db.page("""
|
||||
select
|
||||
date_format(mes.extrusion_date, '%Y-%m-%d') as extrusion_date,
|
||||
mes.extrusion_machine,
|
||||
mpm.machine_name as extrusion_machine_name,
|
||||
mes.extrusion_team,
|
||||
su.user_name as extrusion_team_name,
|
||||
mesd.schedule_number,
|
||||
mesd.production_length,
|
||||
mesd.production_pieces,
|
||||
mesd.sawing_method,
|
||||
su2.user_name as salesperson_name,
|
||||
${salesOrdeSelect}
|
||||
from
|
||||
mini_extrusion_schedule_detail mesd
|
||||
left join mini_extrusion_schedule mes on mes.schedule_number = mesd.schedule_number
|
||||
left join sys_user su on su.user_id = mes.extrusion_team
|
||||
left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
|
||||
|
||||
left join mini_sales_order_materials msm
|
||||
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
|
||||
left join mini_sales_orders mso on mso.document_number = msm.sales_order_code
|
||||
left join sys_user su2 on su2.user_id = mso.salesperson
|
||||
where 1=1
|
||||
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
|
||||
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}
|
||||
?{orderNo != null and orderNo != '', and msm.order_no like concat('%', #{orderNo}, '%')}
|
||||
?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')}
|
||||
?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')}
|
||||
?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}}
|
||||
|
||||
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
|
||||
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
|
||||
?{surfaceMethod != null and surfaceMethod != '', and msm.surface_method = #{surfaceMethod}}
|
||||
""")
|
||||
|
||||
return list.list
|
@ -0,0 +1,69 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "78482de7c59040fe9939e6628c02ee0f",
|
||||
"script" : null,
|
||||
"groupId" : "753fe736c4d7438090c366180c352d95",
|
||||
"name" : "挤压排产总数",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732611825930,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/count",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "body",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : null,
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
import '@/common/sql' as sql
|
||||
|
||||
String salesOrdeSelect = sql("salesOrder")
|
||||
String scheduleNumber = body["scheduleNumber"];
|
||||
String salesOrderCode = body["salesOrderCode"];
|
||||
String orderNo = body["orderNo"];
|
||||
String materialCode = body["materialCode"];
|
||||
String profileModel = body["profileModel"];
|
||||
String salesStatus = body["salesStatus"];
|
||||
|
||||
String extrusionDate = body['extrusionDate'];
|
||||
String customerId = body['customerId'];
|
||||
String surfaceMethod = body['surfaceMethod'];
|
||||
|
||||
return db.selectInt("""
|
||||
select
|
||||
count(1)
|
||||
from
|
||||
mini_extrusion_schedule_detail mesd
|
||||
left join mini_extrusion_schedule mes on mes.schedule_number = mesd.schedule_number
|
||||
left join sys_user su on su.user_id = mes.extrusion_team
|
||||
left join mini_production_machines mpm on mpm.machine_code = mes.extrusion_machine
|
||||
|
||||
left join mini_sales_order_materials msm
|
||||
on mesd.sales_order_code = msm.sales_order_code and mesd.material_code = msm.material_code and mesd.order_no = msm.order_no
|
||||
left join mini_sales_orders mso on mso.document_number = msm.sales_order_code
|
||||
left join sys_user su2 on su2.user_id = mso.salesperson
|
||||
where 1=1
|
||||
?{scheduleNumber != null and scheduleNumber != '', and mesd.schedule_number like concat('%', #{scheduleNumber}, '%')}
|
||||
?{salesOrderCode != null and salesOrderCode != '', and msm.sales_order_code like concat('%', #{salesOrderCode}, '%')}
|
||||
?{orderNo != null and orderNo != '', and msm.order_no like concat('%', #{orderNo}, '%')}
|
||||
?{materialCode != null and materialCode != '', and msm.material_code like concat('%', #{materialCode}, '%')}
|
||||
?{profileModel != null and profileModel != '', and msm.profile_model like concat('%', #{profileModel}, '%')}
|
||||
?{salesStatus != null and salesStatus != '', and mso.status = #{salesStatus}}
|
||||
|
||||
?{extrusionDate!=null && extrusionDate!="", and date(mes.extrusion_date) = #{extrusionDate} }
|
||||
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
|
||||
?{surfaceMethod != null and surfaceMethod != '', and msm.surface_method = #{surfaceMethod}}
|
||||
""")
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "ac6602436d574b049dcf80eee3ff5d8d",
|
||||
"name" : "订单跟踪",
|
||||
"type" : "function",
|
||||
"parentId" : "414d04bbdc2e4cb5a23145a0bfe0e649",
|
||||
"path" : "orderTracking",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732601307816,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"paths" : [ ],
|
||||
"options" : [ ]
|
||||
}
|
@ -0,0 +1,318 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "b9d2add17088436ea92dd36fd1462557",
|
||||
"script" : null,
|
||||
"groupId" : "ac6602436d574b049dcf80eee3ff5d8d",
|
||||
"name" : "订单跟踪列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732609621796,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/list",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "salesOrderList",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.lang.Object",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
String salesOrderCode = body['salesOrderCode'];
|
||||
String orderNo = body['orderNo'];
|
||||
String materialCode = body['materialCode'];
|
||||
String profileModel = body['profileModel'];
|
||||
String customerId = body['customerId'];
|
||||
String surfaceMethod = body['surfaceMethod'];
|
||||
|
||||
println("订单跟踪列表")
|
||||
println(body)
|
||||
|
||||
// ==============================
|
||||
// 1.查询销售单明细
|
||||
// ==============================
|
||||
var sql = """
|
||||
select
|
||||
msom.sales_order_code,
|
||||
msom.order_no,
|
||||
msom.material_code,
|
||||
msom.material_name,
|
||||
msom.profile_model,
|
||||
msom.specification,
|
||||
msom.thickness,
|
||||
msom.weight,
|
||||
msom.order_length,
|
||||
msom.order_total_quantity,
|
||||
msom.surface_method,
|
||||
msom.delivery_date,
|
||||
msom.theoretical_weight,
|
||||
msom.produced_pieces,
|
||||
msom.produced_length
|
||||
from mini_sales_order_materials msom
|
||||
left join mini_sales_orders mso on mso.document_number = msom.sales_order_code
|
||||
where 1=1
|
||||
?{orderNo != null and orderNo != '', and msom.order_no like concat('%', #{orderNo}, '%')}
|
||||
?{materialCode != null and materialCode != '', and msom.material_code like concat('%', #{materialCode}, '%')}
|
||||
?{profileModel != null and profileModel != '', and msom.profile_model like concat('%', #{profileModel}, '%')}
|
||||
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
|
||||
?{surfaceMethod != null and surfaceMethod != '', and msom.surface_method = #{surfaceMethod}}
|
||||
?{salesOrderCode != null and salesOrderCode != '', and msom.sales_order_code = #{salesOrderCode}}
|
||||
"""
|
||||
|
||||
Map pages = db.page(sql);
|
||||
|
||||
List salesOrderList = pages.list;
|
||||
|
||||
if (salesOrderList.size() == 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
// ==============================
|
||||
// 2.查询生产计划数据
|
||||
// ==============================
|
||||
var sql2 = """
|
||||
select
|
||||
sales_order_code,
|
||||
order_no,
|
||||
sum(planned_pieces) as planned_pieces
|
||||
from mini_production_schedule
|
||||
where 1=1 and (sales_order_code, order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by sales_order_code, order_no
|
||||
"""
|
||||
List productionScheduleList = db.select(sql2)
|
||||
|
||||
|
||||
// ==============================
|
||||
// 3.查询挤压排产数据
|
||||
// ==============================
|
||||
var sql3 = """
|
||||
select
|
||||
sales_order_code,
|
||||
order_no,
|
||||
group_concat(schedule_number order by schedule_number separator ', ') as schedule_number,
|
||||
sum(production_length) as production_length,
|
||||
sum(production_pieces) as production_pieces,
|
||||
max(sawing_method) as sawing_method
|
||||
from mini_extrusion_schedule_detail
|
||||
where 1=1 and (sales_order_code, order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by sales_order_code, order_no
|
||||
"""
|
||||
List extrusionScheduleDetail = db.select(sql3)
|
||||
|
||||
|
||||
// ==============================
|
||||
// 4.查询报工数据
|
||||
// ==============================
|
||||
var sql4 = """
|
||||
select
|
||||
mpr.sales_order_code,
|
||||
mpr.order_no,
|
||||
mpr.current_process,
|
||||
round((sum(mesd.production_length) * sum(production_number) * sum(production_weight)), 4) as actual_weight_mesd,
|
||||
round((sum(msom.order_length) * sum(production_number) * sum(production_weight)), 4) as actual_weight_msom,
|
||||
sum(production_number) as production_number,
|
||||
max(production_weight) as production_weight
|
||||
from mini_process_report mpr
|
||||
left join mini_extrusion_schedule_detail mesd
|
||||
on mpr.sales_order_code = mesd.sales_order_code and mpr.order_no = mesd.order_no
|
||||
left join mini_sales_order_materials msom
|
||||
on mpr.sales_order_code = msom.sales_order_code and mpr.order_no = msom.order_no
|
||||
where 1=1 and (mpr.sales_order_code, mpr.order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by mpr.sales_order_code, mpr.order_no, mpr.current_process
|
||||
"""
|
||||
|
||||
|
||||
List processReportList = db.select(sql4)
|
||||
|
||||
// 处理数据
|
||||
// actualWeightMesd 排产长度计算
|
||||
// actualWeightMsom 订单长度计算
|
||||
var processReportFinalList = []
|
||||
var arr = ['jingqie','dk','bz']
|
||||
processReportList.group(it => it.salesOrderCode + "_" + it.orderNo, // 根据api_group_id 分组
|
||||
list => list.group(item => item.currentProcess,
|
||||
obj => obj
|
||||
)
|
||||
).each((key, value) => {
|
||||
var jsonObj = {}
|
||||
value.each((key1, value1) => {
|
||||
var val = value1[0];
|
||||
jsonObj["salesOrderCode"] = val.salesOrderCode;
|
||||
jsonObj["orderNo"] = val.orderNo;
|
||||
if (arr.contains(key1)) {
|
||||
jsonObj[key1 + "_actualWeight"] = val.actualWeightMsom;
|
||||
} else {
|
||||
jsonObj[key1 + "_actualWeight"] = val.actualWeightMesd;
|
||||
}
|
||||
|
||||
jsonObj[key1 + "_productionNumber"] = val.productionNumber;
|
||||
jsonObj[key1 + "_productionWeight"] = val.productionWeight;
|
||||
})
|
||||
processReportFinalList.push(jsonObj)
|
||||
})
|
||||
|
||||
|
||||
// ==============================
|
||||
// 5.查询长料报废数据
|
||||
// 挤压、精品、氧化上排、氧化下排工序
|
||||
// ==============================
|
||||
var sql5 = """
|
||||
select
|
||||
sales_order_code,
|
||||
order_no,
|
||||
sum(scrap_number) as long_scrap_number,
|
||||
sum(scrap_weight) as long_scrap_weight
|
||||
from mini_process_report mpr
|
||||
where 1=1 and mpr.current_process in ('jiya','jinpin','yanghua1','yanghua2')
|
||||
and (mpr.sales_order_code, mpr.order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by mpr.sales_order_code, mpr.order_no
|
||||
"""
|
||||
List processReportLongList = db.select(sql5)
|
||||
|
||||
// ==============================
|
||||
// 6.查询短料报废数据
|
||||
// 精切,打孔,包装工序
|
||||
// ==============================
|
||||
var sql6 = """
|
||||
select
|
||||
sales_order_code,
|
||||
order_no,
|
||||
sum(scrap_number) as shortage_scrap_number,
|
||||
sum(scrap_weight) as shortage_scrap_weight
|
||||
from mini_process_report mpr
|
||||
where 1=1 and mpr.current_process in ('jingqie','dk','bz')
|
||||
and (mpr.sales_order_code, mpr.order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by mpr.sales_order_code, mpr.order_no
|
||||
"""
|
||||
List processReportShortageList = db.select(sql6)
|
||||
|
||||
// ==============================
|
||||
// 7.入库状况
|
||||
// ==============================
|
||||
var sql7 = """
|
||||
select
|
||||
mpr.sales_order_code,
|
||||
mpr.order_no,
|
||||
sum(mpr.receipt_quantity) as receipt_quantity,
|
||||
sum(mpr.actual_weight) as actual_weight
|
||||
from
|
||||
mini_product_receipt mpr
|
||||
where 1=1
|
||||
and (mpr.sales_order_code, mpr.order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by mpr.sales_order_code, mpr.order_no
|
||||
"""
|
||||
List productReceiptList = db.select(sql7)
|
||||
|
||||
// ==============================
|
||||
// 8.出库和库存数据
|
||||
// ==============================
|
||||
// (sum(mwp.existing_inventory) - sum(mssm.shipment_quantity)) as no_shipment_quantity,
|
||||
// (sum(mwp.actual_weight) - sum(mssm.actual_weight)) as no_actual_weight,
|
||||
var sql8 = """
|
||||
select
|
||||
mssm.sales_order_code,
|
||||
mssm.order_no,
|
||||
sum(mssm.shipment_quantity) as shipment_quantity,
|
||||
sum(mssm.actual_weight) as shipment_actual_weight,
|
||||
sum(mwp.existing_inventory) as no_shipment_quantity,
|
||||
sum(mwp.actual_weight) as no_actual_weight,
|
||||
round((sum(mwp.existing_inventory) + sum(mssm.shipment_quantity)), 4) as existing_inventory,
|
||||
round((sum(mwp.actual_weight) + sum(mssm.actual_weight)), 4) as existing_actual_weight
|
||||
from
|
||||
mini_sales_shipment_materials mssm
|
||||
left join mini_warehouse_product mwp on
|
||||
mwp.order_no = mssm.order_no
|
||||
and mwp.sales_order_code = mssm.sales_order_code
|
||||
where 1=1
|
||||
and (mssm.sales_order_code, mssm.order_no) in (
|
||||
<foreach item='item' index='index' collection='salesOrderList' separator=','>
|
||||
(#{item.salesOrderCode}, #{item.orderNo})
|
||||
</foreach>
|
||||
)
|
||||
group by mssm.sales_order_code, mssm.order_no
|
||||
"""
|
||||
List salesShipmenList = db.select(sql8)
|
||||
|
||||
var result = select
|
||||
a.*,
|
||||
b.plannedPieces,
|
||||
c.productionLength,
|
||||
c.productionPieces,
|
||||
c.sawingMethod,
|
||||
ifnull(e.longScrapNumber, 0) longScrapNumber,
|
||||
ifnull(e.longScrapWeight, 0) longScrapWeight,
|
||||
ifnull(f.shortageScrapNumber, 0) shortageScrapNumber,
|
||||
ifnull(f.shortageScrapWeight, 0) shortageScrapWeight,
|
||||
ifnull(d.jiya_actualWeight, 0) jiya_actualWeight,
|
||||
ifnull(d.jiya_productionNumber, 0) jiya_productionNumber,
|
||||
ifnull(d.jiya_productionWeight, 0) jiya_productionWeight,
|
||||
ifnull(d.jingpin_actualWeight, 0) jingpin_actualWeight,
|
||||
ifnull(d.jingpin_productionNumber, 0) jingpin_productionNumber,
|
||||
ifnull(d.jingpin_productionWeight, 0) jingpin_productionWeight,
|
||||
ifnull(d.yanghau1_actualWeight, 0) yanghau1_actualWeight,
|
||||
ifnull(d.yanghau1_productionNumber, 0) yanghau1_productionNumber,
|
||||
ifnull(d.yanghau1_productionWeight, 0) yanghau1_productionWeight,
|
||||
ifnull(d.yanghua2_actualWeight, 0) yanghua2_actualWeight,
|
||||
ifnull(d.yanghua2_productionNumber, 0) yanghua2_productionNumber,
|
||||
ifnull(d.yanghua2_productionWeight, 0) yanghua2_productionWeight,
|
||||
ifnull(d.jingqie_actualWeight, 0) jingqie_actualWeight,
|
||||
ifnull(d.jingqie_productionNumber, 0) jingqie_productionNumber,
|
||||
ifnull(d.jingqie_productionWeight, 0) jingqie_productionWeight,
|
||||
ifnull(d.dk_actualWeight, 0) dk_actualWeight,
|
||||
ifnull(d.dk_productionNumber, 0) dk_productionNumber,
|
||||
ifnull(d.dk_productionWeight, 0) dk_productionWeight,
|
||||
ifnull(d.bz_actualWeight, 0) bz_actualWeight,
|
||||
ifnull(d.bz_productionNumber, 0) bz_productionNumber,
|
||||
ifnull(d.bz_productionWeight, 0) bz_productionWeight,
|
||||
ifnull(g.receiptQuantity, 0) receiptQuantity,
|
||||
ifnull(g.actualWeight, 0) actualWeight,
|
||||
ifnull(h.shipmentQuantity, 0) shipmentQuantity,
|
||||
ifnull(h.shipmentActualWeight, 0) shipmentActualWeight,
|
||||
ifnull(h.noShipmentQuantity, 0) noShipmentQuantity,
|
||||
ifnull(h.noActualWeight, 0) noActualWeight,
|
||||
ifnull(h.existingInventory, 0) existingInventory,
|
||||
ifnull(h.existingActualWeight, 0) existingActualWeight
|
||||
from salesOrderList a
|
||||
left join productionScheduleList b on a.salesOrderCode = b.salesOrderCode and a.orderNo = b.orderNo
|
||||
left join extrusionScheduleDetail c on a.salesOrderCode = c.salesOrderCode and a.orderNo = c.orderNo
|
||||
left join processReportFinalList d on a.salesOrderCode = d.salesOrderCode and a.orderNo = d.orderNo
|
||||
left join processReportLongList e on a.salesOrderCode = e.salesOrderCode and a.orderNo = e.orderNo
|
||||
left join processReportShortageList f on a.salesOrderCode = f.salesOrderCode and a.orderNo = f.orderNo
|
||||
left join productReceiptList g on a.salesOrderCode = g.salesOrderCode and a.orderNo = g.orderNo
|
||||
left join salesShipmenList h on a.salesOrderCode = h.salesOrderCode and a.orderNo = h.orderNo
|
||||
|
||||
return result
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"properties" : { },
|
||||
"id" : "d96963a3d8d94fb2acb55a09d05266f9",
|
||||
"script" : null,
|
||||
"groupId" : "ac6602436d574b049dcf80eee3ff5d8d",
|
||||
"name" : "订单跟踪总数",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1732603321523,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
"path" : "/count",
|
||||
"description" : null,
|
||||
"returnType" : null,
|
||||
"mappingPath" : null,
|
||||
"parameters" : [ {
|
||||
"name" : "body",
|
||||
"value" : null,
|
||||
"description" : null,
|
||||
"required" : false,
|
||||
"dataType" : "String",
|
||||
"type" : "java.util.Map",
|
||||
"defaultValue" : null,
|
||||
"validateType" : null,
|
||||
"error" : null,
|
||||
"expression" : null,
|
||||
"children" : null
|
||||
} ]
|
||||
}
|
||||
================================
|
||||
String salesOrderCode = body['salesOrderCode'];
|
||||
String orderNo = body['orderNo'];
|
||||
String materialCode = body['materialCode'];
|
||||
String profileModel = body['profileModel'];
|
||||
String customerId = body['customerId'];
|
||||
String surfaceMethod = body['surfaceMethod'];
|
||||
|
||||
var sql = """
|
||||
select
|
||||
count(1)
|
||||
from mini_sales_order_materials msom
|
||||
left join mini_sales_orders mso on mso.document_number = msom.sales_order_code
|
||||
where 1=1
|
||||
?{orderNo != null and orderNo != '', and msom.order_no like concat('%', #{orderNo}, '%')}
|
||||
?{materialCode != null and materialCode != '', and msom.material_code like concat('%', #{materialCode}, '%')}
|
||||
?{profileModel != null and profileModel != '', and msom.profile_model like concat('%', #{profileModel}, '%')}
|
||||
?{customerId != null and customerId != '', and mso.customer_id = #{customerId}}
|
||||
?{surfaceMethod != null and surfaceMethod != '', and msom.surface_method = #{surfaceMethod}}
|
||||
?{salesOrderCode != null and salesOrderCode != '', and msom.sales_order_code = #{salesOrderCode}}
|
||||
"""
|
||||
|
||||
return db.selectInt(sql);
|
Loading…
Reference in New Issue