@ -5,7 +5,7 @@
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"groupId" : "06bb1cef20924ed8887b1c3ae8a91d3a",
"name" : "修改",
"name" : "修改",
"createTime" : null,
"createTime" : null,
"updateTime" : 1729144854213 ,
"updateTime" : 1731737082705 ,
"lock" : null,
"lock" : null,
"createBy" : null,
"createBy" : null,
"updateBy" : null,
"updateBy" : null,
@ -25,10 +25,10 @@
"expression" : null,
"expression" : null,
"children" : null
"children" : null
} ],
} ],
"requestBody" : "{\r\n \"id\": 2,\r\n \"productionNumber\": 12,\r\n \"productionWeight\": 12,\r\n \"scrapNumber\": 12,\r\n \"scrapReason\": \"243\",\r\n \"frameNumber\": \"123\",\r\n \"nextProcess\": \"yanghua\",\r\n \"isCompleted\": \"\",\r\n \"remarks\": \"11\",\r\n \"reportNumber\": \"20240807\",\r\n \"machine\": \"测试机台2\",\r\n \"operator\": \"张三\",\r\n \"workshop\": \"挤压车间2\",\r\n \"reportDate\": \"2024-09-02 00:00:00\",\r\n \"currentProcess\": \"挤压报工\" \r\n}",
"requestBody" : "{\r\n \"id\": 2772,\r\n \"productionNumber\": 100,\r\n \"productionWeight\": 100,\r\n \"scrapNumber\": 0,\r\n \"scrapReason\": null,\r\n \"frameNumber\": null,\r\n \"nextProcess\": \"yanghua2\",\r\n \"isCompleted\": 0,\r\n \"remarks\": \"\",\r\n \"reportNumber\": \"JY24111500\",\r\n \"machine\": null,\r\n \"operator\": null,\r\n \"workshop\": null,\r\n \"reportDate\": \"2024-11-15\",\r\n \"currentProcess\": \"jiya\",\r\n \"salesOrderCode\": \"KFCS20241114-000\",\r\n \"scheduleNumber\": \"JY20241115006\",\r\n \"profileModel\": \"6430-120\",\r\n \"moldCode\": null,\r\n \"moldModel\": null,\r\n \"moldThickness\": null,\r\n \"moldManufacturer\": null,\r\n \"moldColor\": null,\r\n \"moldChangeReason\": null,\r\n \"rodCount\": null \r\n}",
"headers" : [ {
"headers" : [ {
"name" : "authorization",
"name" : "authorization",
"value" : "5E34C0D7EA601026B93C26119C7E1AD59CF35D76F0DCA5272366FC6A87E41372412D8F4473A6A7BD5E5C1D4E94AEFD40 ",
"value" : "5E34C0D7EA601026B93C26119C7E1AD5304936225AC6AC0DD5E00182C1DF3624BE38DB349BDC91696CBC04B5F9AB5B53 ",
"description" : "登录token",
"description" : "登录token",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
@ -40,12 +40,14 @@
"children" : null
"children" : null
} ],
} ],
"paths" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"code\": -2,\n \"message\": \"token无效\",\n \"data\": null,\n \"timestamp\": 1726813009589,\n \"executeTime\": null \n}",
"responseBody" : "{\n \"code\": 0,\n \"data\": null,\n \"message\": \"success\" \n}",
"description" : null,
"description" : null,
"requestBodyDefinition" : null,
"requestBodyDefinition" : null,
"responseBodyDefinition" : null
"responseBodyDefinition" : null
}
}
================================
================================
import 'commonServices' as CommonServices
String id = body.id;
String id = body.id;
String productionNumber = body.productionNumber;
String productionNumber = body.productionNumber;
String productionWeight = body.productionWeight;
String productionWeight = body.productionWeight;
@ -53,10 +55,23 @@ String scrapNumber = body.scrapNumber;
String scrapReason = body.scrapReason;
String scrapReason = body.scrapReason;
String frameNumber = body.frameNumber;
String frameNumber = body.frameNumber;
String nextProcess = body.nextProcess;
String nextProcess = body.nextProcess;
String netReceipts = body.netReceipts;
String isCompleted = body.isCompleted;
String isCompleted = body.isCompleted;
String remarks = body.remarks;
String remarks = body.remarks;
Map map = db.selectOne("select * from mini_process_report where id=#{id}")
String remarks = body.remarks;
Map map = db.selectOne("""
select mpr.*,
mesd.production_length,
mesd.production_pieces,
mesd.sawing_method
from mini_process_report mpr
left join mini_extrusion_schedule_detail mesd
on mpr.sales_order_code = mesd.sales_order_code and mpr.material_code = mesd.material_code and mpr.order_no = mesd.order_no
where mpr.id=#{id}
""")
var tx = db.transaction()
var tx = db.transaction()
try {
try {
@ -68,24 +83,49 @@ try {
scrap_number: scrapNumber,
scrap_number: scrapNumber,
scrap_reason: scrapReason,
scrap_reason: scrapReason,
frame_number: frameNumber,
frame_number: frameNumber,
net_receipts: netReceipts,
next_process: nextProcess,
next_process: nextProcess,
is_completed: isCompleted,
is_completed: isCompleted,
remarks: remarks,
remarks: remarks,
})
})
if (res <= 0) {
if (res <= 0) {
tx.rollback();
tx.rollback();
exit -1, "失败"
exit - 1, "失败"
}
}
if ((Objects.isNull(nextProcess) || nextProcess == "")) {
// if ((Objects.isNull(nextProcess) || nextProcess == "")) {
// if (isCompleted == 1) {
// // 完成更新
// }
// tx.commit()
// return;
// }
if (isCompleted == 1) {
if (isCompleted == 1) {
// 更新订单表中的生产数量
// 完成更新
res = db.update("""
}
update mini_sales_order_materials
SET produced_pieces = produced_pieces + #{map.productionPieces},
produced_length = produced_length + #{map.productionLength}
WHERE material_code = #{map.materialCode} and sales_order_code = #{map.salesOrderCode}
and order_no = #{map.orderNo}
""")
// 完成更新
tx.commit()
tx.commit()
return;
return;
}
}
// 自动生成编码
Map codeParams = new HashMap();
codeParams.put("currentProcess", nextProcess);
map.reportNumber = CommonServices.getCode("ProductionOrderNumberSub", codeParams)
// 插入新工序
// 插入新工序
res = db.table("mini_process_report").insert({
res = db.table("mini_process_report").insert({
schedule_number: map.scheduleNumber,
schedule_number: map.scheduleNumber,
@ -99,8 +139,16 @@ try {
source_number: productionNumber,
source_number: productionNumber,
net_receipts: productionNumber,
net_receipts: productionNumber,
sales_order_code: map.salesOrderCode,
sales_order_code: map.salesOrderCode,
order_no: map.orderNo,
material_code: map.materialCode,
material_code: map.materialCode,
frame_number: map.frameNumber,
frame_number: map.frameNumber,
mold_code: map.moldCode,
mold_model: map.moldModel,
mold_thickness: map.moldThickness,
mold_manufacturer: map.moldManufacturer,
mold_color: map.moldColor,
mold_change_reason: map.moldChangeReason,
rod_count: map.rodCount,
})
})
if (res > 0) {
if (res > 0) {
@ -108,9 +156,10 @@ try {
return;
return;
}
}
tx.rollback();
tx.rollback();
exit -1, "失败"
exit - 1, "失败"
return;
return;
} catch(e) {
} catch (e) {
print(e.getMessage())
tx.rollback()
tx.rollback()
exit -1, "失败"
exit - 1, "失败"
}
}