diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/rest/MesToLmsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/rest/MesToLmsController.java index a9103e241..35ca45bcb 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/rest/MesToLmsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/rest/MesToLmsController.java @@ -1,5 +1,6 @@ package org.nl.wms.ext.mes.rest; +import cn.dev33.satoken.annotation.SaIgnore; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -25,6 +26,7 @@ public class MesToLmsController { @PostMapping("/momRollFoilStart") @Log("母卷批次创建信息发送智能物流(MES生箔工序Move In)") @ApiOperation("母卷批次创建信息发送智能物流(MES生箔工序Move In)") + @SaIgnore public ResponseEntity momRollFoilStart(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.momRollFoilStart(jo), HttpStatus.OK); } @@ -32,6 +34,7 @@ public class MesToLmsController { @PostMapping("momRollFoilWeighing") @Log("MES获取AGV称重信息") @ApiOperation("MES获取AGV称重信息") + @SaIgnore public ResponseEntity momRollFoilWeighing(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.momRollFoilWeighing(jo), HttpStatus.OK); } @@ -39,6 +42,7 @@ public class MesToLmsController { @PostMapping("/momRollFoilComplete") @Log("MES执行下卷动作告诉LMS") @ApiOperation("MES执行下卷动作告诉LMS") + @SaIgnore public ResponseEntity momRollFoilComplete(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.momRollFoilComplete(jo), HttpStatus.OK); } @@ -46,6 +50,7 @@ public class MesToLmsController { @PostMapping("/momRollBakeNextSpecTransfer") @Log("MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)") @ApiOperation("MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out)") + @SaIgnore public ResponseEntity momRollBakeNextSpecTransfer(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.momRollBakeNextSpecTransfer(jo), HttpStatus.OK); } @@ -53,6 +58,7 @@ public class MesToLmsController { @PostMapping("/cutPlanTransfer") @Log("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流") @ApiOperation("分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流") + @SaIgnore public ResponseEntity cutPlanTransfer(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.cutPlanTransfer(jo), HttpStatus.OK); } @@ -60,6 +66,7 @@ public class MesToLmsController { @PostMapping("/callNextAssAndMomRoll") @Log("分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流") @ApiOperation("分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流") + @SaIgnore public ResponseEntity callNextAssAndMomRoll(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.callNextAssAndMomRoll(jo), HttpStatus.OK); } @@ -67,6 +74,7 @@ public class MesToLmsController { @PostMapping("/childRollCutStartComp") @Log("当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令") @ApiOperation("当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令") + @SaIgnore public ResponseEntity childRollCutStartComp(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.childRollCutStartComp(jo), HttpStatus.OK); } @@ -74,6 +82,7 @@ public class MesToLmsController { @PostMapping("/childRollPackComplete") @Log("包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库") @ApiOperation("包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库") + @SaIgnore public ResponseEntity childRollPackComplete(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.childRollPackComplete(jo), HttpStatus.OK); } @@ -81,6 +90,7 @@ public class MesToLmsController { @PostMapping("/inventoryTransferInfoSync") @Log("转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签") @ApiOperation("转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签") + @SaIgnore public ResponseEntity inventoryTransferInfoSync(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.inventoryTransferInfoSync(jo), HttpStatus.OK); } @@ -88,6 +98,7 @@ public class MesToLmsController { @PostMapping("/childRollInfoUpdate") @Log("子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder") @ApiOperation("子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder") + @SaIgnore public ResponseEntity childRollInfoUpdate(@RequestBody JSONObject jo) { return new ResponseEntity<>(mesToLmsService.childRollInfoUpdate(jo), HttpStatus.OK); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 9413b6189..ed2d41d1d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -21,22 +21,21 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 生箔烘箱: * 母卷批次创建信息发送智能物流(MES生箔工序Move In) - * - * + *

+ *

* 返回成功一条参数状态"S": * { - * "RTYPE": "S", - * "RTMSG": "成功", - * "RTOAL": 1, - * "RTDAT": null + * "RTYPE": "S", + * "RTMSG": "成功", + * "RTOAL": 1, + * "RTDAT": null * } * - * * @return */ @Override public JSONObject momRollFoilStart(JSONObject param) { - log.info("momRollFoilStart接口输入参数为:-------------------"+param.toString()); + log.info("momRollFoilStart接口输入参数为:-------------------" + param.toString()); String containerName = param.getString("ContainerName"); String ResourceName = param.getString("ResourceName"); @@ -48,7 +47,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { String UpCoilerDate = param.getString("UpCoilerDate"); String IsReloadSend = param.getString("IsReloadSend"); - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); + WQLObject pointTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); WQLObject orderTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); JSONObject result = new JSONObject(); @@ -64,25 +63,27 @@ public class MesToLmsServiceImpl implements MesToLmsService { if (ObjectUtil.isEmpty(UpCoilerDate)) throw new BadRequestException("开始时间不能为空"); if (ObjectUtil.isEmpty(IsReloadSend)) throw new BadRequestException("是否重新更新不能为空"); - JSONObject jsonPoint = pointTab.query("ext_code ='" + ResourceName + "' and is_delete = '0'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("对应点位不存在"); + JSONObject jsonPoint = pointTab.query("ext_code ='" + ResourceName + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonPoint)) { + jsonPoint = new JSONObject(); + } // 插入生箔工序工单表 JSONObject json = new JSONObject(); - json.put("workorder_id", IdUtil.getSnowflake(1,1).nextId()); - json.put("container_name",containerName); - json.put("resource_name",ResourceName); - json.put("mfg_order_name",MfgOrderName); - json.put("product_name",ProductName); - json.put("description",Description); - json.put("theory_height",TheoryHeight); - json.put("eqp_velocity",EqpVelocity); - json.put("up_coiler_date",UpCoilerDate); - json.put("is_reload_send",IsReloadSend); + json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId()); + json.put("container_name", containerName); + json.put("resource_name", ResourceName); + json.put("mfg_order_name", MfgOrderName); + json.put("product_name", ProductName); + json.put("description", Description); + json.put("theory_height", TheoryHeight); + json.put("eqp_velocity", EqpVelocity); + json.put("up_coiler_date", UpCoilerDate); + json.put("is_reload_send", IsReloadSend); json.put("product_area", jsonPoint.getString("product_area")); json.put("point_code", jsonPoint.getString("point_code")); json.put("realstart_time", DateUtil.now()); - json.put("status", "1"); + json.put("status", "01"); json.put("is_delete", "0"); json.put("agvno", "0"); json.put("productin_qty", 0); @@ -100,7 +101,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { } catch (Exception e) { // 返回失败 result.put("RTYPE", "S"); - result.put("RTMSG", "操作失败!"+e.getMessage()); + result.put("RTMSG", "操作失败!" + e.getMessage()); result.put("RTOAL", 0); result.put("RTDAT", null); System.out.println(result); @@ -115,13 +116,22 @@ public class MesToLmsServiceImpl implements MesToLmsService { */ @Override public JSONObject momRollFoilWeighing(JSONObject param) { - log.info("momRollFoilStart接口输入参数为:-------------------"+param.toString()); + log.info("momRollFoilStart接口输入参数为:-------------------" + param.toString()); - JSONArray data=new JSONArray(); - JSONObject json=new JSONObject(); - json.put("ContainerName","母卷号"); - json.put("ResourceName","设备号"); - json.put("Weight",80); + String ContainerName = param.getString("ContainerName"); + String ResourceName = param.getString("ResourceName"); + //查询该母卷号、设备号对应的生箔工单 + JSONObject raw_jo = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").query("container_name ='" + ContainerName + "' AND resource_name = '" + ResourceName + "'").uniqueResult(0); + + if (ObjectUtil.isEmpty(raw_jo)) { + throw new BadRequestException("未查询到对应的生箔工单!"); + } + + JSONArray data = new JSONArray(); + JSONObject json = new JSONObject(); + json.put("ContainerName", raw_jo.getString("container_name")); + json.put("ResourceName", raw_jo.getString("resource_name")); + json.put("Weight", String.format("%.2f", raw_jo.getDoubleValue("productin_qty"))); json.put("WeighDate", DateUtil.now()); data.add(json); JSONObject result = new JSONObject(); @@ -135,12 +145,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * MES执行下卷动作告诉LMS + * * @param param * @return */ @Override public JSONObject momRollFoilComplete(JSONObject param) { - log.info("momRollFoilComplete接口输入参数为:-------------------"+param.toString()); + log.info("momRollFoilComplete接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); @@ -153,12 +164,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * MES下达烘箱温度和时间配方给智能物流(MES 包装防护工序Move Out) + * * @param param * @return */ @Override public JSONObject momRollBakeNextSpecTransfer(JSONObject param) { - log.info("momRollBakeNextSpecTransfer接口输入参数为:-------------------"+param.toString()); + log.info("momRollBakeNextSpecTransfer接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); @@ -171,12 +183,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 分切包装段:分切计划(单表,包含母卷/改制子卷-包装箱号、空包装箱物料、纸筒/FRP管)MES下发智能物流 + * * @param param * @return */ @Override public JSONObject cutPlanTransfer(JSONObject param) { - log.info("cutPlanTransfer接口输入参数为:-------------------"+param.toString()); + log.info("cutPlanTransfer接口输入参数为:-------------------" + param.toString()); String orderType = param.getString("OrderType"); // 分切订单类型 String ContainerName = param.getString("ContainerName"); // 子卷号 @@ -218,9 +231,11 @@ public class MesToLmsServiceImpl implements MesToLmsService { * 2.当订单类型为2(改制)时 RestructContainerName 改制来源子卷号、PackageBoxSN 子卷立库木箱号 不能为空 */ if (StrUtil.equals(orderType, "1")) { - if (ObjectUtil.isEmpty(param.getString("ParentContainerName"))) throw new BadRequestException("来源母卷号不能为空"); + if (ObjectUtil.isEmpty(param.getString("ParentContainerName"))) + throw new BadRequestException("来源母卷号不能为空"); } else { - if (ObjectUtil.isEmpty(param.getString("RestructContainerName"))) throw new BadRequestException("改制来源子卷号不能为空"); + if (ObjectUtil.isEmpty(param.getString("RestructContainerName"))) + throw new BadRequestException("改制来源子卷号不能为空"); if (ObjectUtil.isEmpty(param.getString("PackageBoxSN"))) throw new BadRequestException("子卷立库木箱号不能为空"); } /* PaperTubeOrFRP @@ -228,17 +243,20 @@ public class MesToLmsServiceImpl implements MesToLmsService { * 2.当管件类型为2(FRP管)时 FRPMaterial FRP管物料编码、FRPDescription FRP管物料描述、FRPModel FRP管规格 不能为空 */ if (StrUtil.equals(PaperTubeOrFRP, "1")) { - if (ObjectUtil.isEmpty(param.getString("PaperTubeMaterial"))) throw new BadRequestException("纸筒物料编码不能为空"); - if (ObjectUtil.isEmpty(param.getString("PaperTubeDescription"))) throw new BadRequestException("纸筒物料描述不能为空"); + if (ObjectUtil.isEmpty(param.getString("PaperTubeMaterial"))) + throw new BadRequestException("纸筒物料编码不能为空"); + if (ObjectUtil.isEmpty(param.getString("PaperTubeDescription"))) + throw new BadRequestException("纸筒物料描述不能为空"); if (ObjectUtil.isEmpty(param.getString("PaperTubeModel"))) throw new BadRequestException("纸筒规格不能为空"); } else { if (ObjectUtil.isEmpty(param.getString("FRPMaterial"))) throw new BadRequestException("FRP管物料编码不能为空"); - if (ObjectUtil.isEmpty(param.getString("FRPDescription"))) throw new BadRequestException("FRP管物料描述不能为空"); + if (ObjectUtil.isEmpty(param.getString("FRPDescription"))) + throw new BadRequestException("FRP管物料描述不能为空"); if (ObjectUtil.isEmpty(param.getString("FRPModel"))) throw new BadRequestException("FRP管规格不能为空"); } JSONObject json = new JSONObject(); - json.put("workorder_id", IdUtil.getSnowflake(1,1).nextId()); + json.put("workorder_id", IdUtil.getSnowflake(1, 1).nextId()); json.put("order_type", orderType); json.put("container_name", ContainerName); json.put("product_name", ProductName); @@ -262,12 +280,12 @@ public class MesToLmsServiceImpl implements MesToLmsService { json.put("split_breadth", SplitBreadth); json.put("split_height", SplitHeight); json.put("split_weight", SplitWeight); - json.put("start_time",DateUtil.now()); - json.put("status","1"); - json.put("is_parent_ok","0"); - json.put("is_child_tz_ok","0"); - json.put("is_child_ps_ok","0"); - json.put("is_delete","0"); + json.put("start_time", DateUtil.now()); + json.put("status", "1"); + json.put("is_parent_ok", "0"); + json.put("is_child_tz_ok", "0"); + json.put("is_child_ps_ok", "0"); + json.put("is_delete", "0"); tab.insert(json); result.put("RTYPE", "S"); @@ -277,7 +295,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { System.out.println(result); } catch (Exception e) { result.put("RTYPE", "S"); - result.put("RTMSG", "操作失败!"+e.getMessage()); + result.put("RTMSG", "操作失败!" + e.getMessage()); result.put("RTOAL", 0); result.put("RTDAT", null); System.out.println(result); @@ -287,12 +305,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 分切即将完成,呼叫配送下一个母卷/改制子卷,MES传智能物流 + * * @param param * @return */ @Override public JSONObject callNextAssAndMomRoll(JSONObject param) { - log.info("callNextAssAndMomRoll接口输入参数为:-------------------"+param.toString()); + log.info("callNextAssAndMomRoll接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); @@ -304,12 +323,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 当母卷开始分切时,MES系统会将对应的子卷进站信息发送给只能物流系统,一方面物流系统可以预估下个母卷的送达时间,也可以闭环期分切计划指令 + * * @param param * @return */ @Override public JSONObject childRollCutStartComp(JSONObject param) { - log.info("childRollCutStartComp接口输入参数为:-------------------"+param.toString()); + log.info("childRollCutStartComp接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); @@ -321,12 +341,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 包装完成,传智能物流包装箱与子卷关系及子卷属性值,LMS执行入库 + * * @param param * @return */ @Override public JSONObject childRollPackComplete(JSONObject param) { - log.info("childRollPackComplete接口输入参数为:-------------------"+param.toString()); + log.info("childRollPackComplete接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); @@ -338,12 +359,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 转单指令在MES平台查看后,更新信息,发送LMS(是否拆包、更新后的入库日期、是否更换外包装箱标签),LMS重打子卷标签、包装箱外标签 + * * @param param * @return */ @Override public JSONObject inventoryTransferInfoSync(JSONObject param) { - log.info("inventoryTransferInfoSync接口输入参数为:-------------------"+param.toString()); + log.info("inventoryTransferInfoSync接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); @@ -355,12 +377,13 @@ public class MesToLmsServiceImpl implements MesToLmsService { /** * 子卷信息更新:计划外需求有可能入库完成后,ERP才回传计划外需求SalesOrder + * * @param param * @return */ @Override public JSONObject childRollInfoUpdate(JSONObject param) { - log.info("childRollInfoUpdate接口输入参数为:-------------------"+param.toString()); + log.info("childRollInfoUpdate接口输入参数为:-------------------" + param.toString()); JSONObject result = new JSONObject(); result.put("RTYPE", "S"); result.put("RTMSG", "操作成功!"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java index 69e09bd2c..163f3a123 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/RawFoilServiceImpl.java @@ -73,8 +73,8 @@ public class RawFoilServiceImpl implements RawFoilService { int need_time = NumberUtil.div(NumberUtil.div(theory_height, eqp_velocity).toString(), "60").intValue();// 分钟 // 计算预计结束时间: 开始时间 + 生产所需时间 - String realstart_time = jsonObject.getString("realstart_time"); - Date date = DateUtil.parse(realstart_time); + String up_coiler_date = jsonObject.getString("up_coiler_date"); + Date date = DateUtil.parse(up_coiler_date); String end_time = DateUtil.offsetMinute(date, need_time).toString(); // 当前时间 - 预计结束时间 : 超过为红色、还有半小时为黄色 @@ -92,7 +92,7 @@ public class RawFoilServiceImpl implements RawFoilService { } json.put("container_name", jsonObject.getString("container_name")); - json.put("realstart_time", jsonObject.getString("realstart_time")); + json.put("up_coiler_date", jsonObject.getString("up_coiler_date")); json.put("end_date", end_time); json.put("point_code", jsonObject.getString("resource_name")); json.put("pcsn", jsonObject.getString("product_name"));