diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java index 0fe289f57..a2a951b56 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/rest/AcsToWmsController.java @@ -58,4 +58,13 @@ public class AcsToWmsController { public ResponseEntity againApply(@RequestBody String task_id) { return new ResponseEntity<>(acsToWmsService.againApply(task_id), HttpStatus.OK); } + + @PostMapping("/deviceApply") + @Log("申请贴标、捆扎") + @ApiOperation("申请贴标、捆扎") + public ResponseEntity deviceApply(@RequestBody JSONObject jo) { + return new ResponseEntity<>(acsToWmsService.deviceApply(jo), HttpStatus.OK); + } + + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java index 17e953807..f6c2de94d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/AcsToWmsService.java @@ -51,4 +51,13 @@ public interface AcsToWmsService { */ JSONObject apply(JSONObject whereJson); + /** + * ACS客户端--->LMS服务端 + * 申请贴标、捆扎 + * + * @param whereJson 条件 + * @return JSONObject + */ + JSONObject deviceApply(JSONObject whereJson); + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 6783bae44..85c14113c 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -2,15 +2,19 @@ package org.nl.wms.ext.acs.service.impl; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.util.SpringContextHolder; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.log.LokiLog; import org.nl.wms.log.LokiLogType; +import org.nl.wms.pda.st.service.PrintService; import org.nl.wms.sch.manage.TaskStatusEnum; import org.nl.wms.sch.service.TaskService; import org.springframework.http.HttpStatus; @@ -25,8 +29,10 @@ import java.util.Map; @RequiredArgsConstructor @Slf4j public class AcsToWmsServiceImpl implements AcsToWmsService { + private final TaskService taskService; + private final PrintService printService; /** * task_id:任务标识 * task_code:任务编码 @@ -185,4 +191,60 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return null; } + + @Override + public JSONObject deviceApply(JSONObject whereJson) { + String vehicle_code = whereJson.getString("vehicle_code"); + String type = whereJson.getString("type"); + if (StrUtil.isEmpty(vehicle_code)){ + throw new BadRequestException("木箱码不能为空!"); + } + if (StrUtil.isEmpty(type)){ + throw new BadRequestException("任务类型不能为空!"); + } + + JSONObject result = new JSONObject(); + + JSONObject sub_jo = WQLObject.getWQLObject("").query("package_box_sn = '"+vehicle_code+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(sub_jo)){ + throw new BadRequestException("未查询到该木箱对应的包装关系!"); + } + if (type.equals("1")){ + //贴标申请 + String print_type = sub_jo.getString("print_type"); + if (StrUtil.isEmpty(print_type)){ + throw new BadRequestException("请指定一台打印机进行打印!"); + } + + String print_code = ""; + switch (print_type){ + case "1": + print_code = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("print_device1").getValue(); + break; + case "2": + print_code = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("print_device2").getValue(); + break; + default: + throw new BadRequestException("未查询到对应打印机!"); + } + JSONObject print_info = WQLObject.getWQLObject("pdm_bi_printinfo").query("print_name = '"+print_code+"'").uniqueResult(0); + JSONObject print_jo = new JSONObject(); + print_jo.put("box_no",vehicle_code); + print_jo.put("print_type",print_info.getString("print_id")); + printService.customerPrint(print_jo); + }else if (type.equals("2")){ + //捆扎申请 + String box_length = sub_jo.getString("box_length"); + String box_width = sub_jo.getString("box_width"); + String box_high = sub_jo.getString("box_high"); + result.put("box_length",box_length); + result.put("box_width",box_width); + result.put("box_high",box_high); + }else { + throw new BadRequestException("请输入正确的任务类型!"); + } + return result; + } + + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/HandleBakingController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/HandleBakingController.java index 95b68136c..5f0a012c8 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/HandleBakingController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/HandleBakingController.java @@ -7,7 +7,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.logging.annotation.Log; import org.nl.wms.pda.mps.service.BakingService; -import org.nl.wms.pda.mps.service.RawFoilService; +import org.nl.wms.pda.mps.service.HandleBakingService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; @@ -17,24 +17,24 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor -@Api(tags = "烘烤工序") -@RequestMapping("api/pda/baking") +@Api(tags = "人工烘烤") +@RequestMapping("api/pda/handleBaking") @Slf4j -public class BakingController { +public class HandleBakingController { - private final BakingService bakingService; + private final HandleBakingService handleBakingService; @PostMapping("/ovenInAndOut") - @Log("烘箱出入") - @ApiOperation("烘箱出入") + @Log("手工烘箱出入") + @ApiOperation("手工烘箱出入") public ResponseEntity queryRawFoil(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(bakingService.ovenInAndOut(whereJson),HttpStatus.OK); + return new ResponseEntity<>(handleBakingService.ovenInAndOut(whereJson),HttpStatus.OK); } - @PostMapping("/inCoolIvt") - @Log("入冷却") - @ApiOperation("入冷却") - public ResponseEntity inCoolIvt(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(bakingService.inCoolIvt(whereJson),HttpStatus.OK); + @PostMapping("/checkConfirm") + @Log("库存变更") + @ApiOperation("库存变更") + public ResponseEntity checkConfirm(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(handleBakingService.checkConfirm(whereJson),HttpStatus.OK); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java index 730720912..2b98898f7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/RawFoilController.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.logging.annotation.Log; +import org.nl.modules.wql.core.content.HttpContext; import org.nl.wms.pda.mps.service.RawFoilService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -34,14 +35,20 @@ public class RawFoilController { @Log("查询生箔生产进度") @ApiOperation("查询生箔生产进度") public ResponseEntity queryRawFoil(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(rawFoilService.queryRawFoil(whereJson), HttpStatus.OK); + HttpContext ctx = new HttpContext("11"); + ctx.setPage((String) (whereJson.get("page"))); + ctx.setRows((String) (whereJson.get("size"))); + return new ResponseEntity<>(rawFoilService.queryRawFoil(whereJson, ctx), HttpStatus.OK); } @PostMapping("/queryRawFoilList") @Log("查询生箔工单") @ApiOperation("查询生箔工单") public ResponseEntity queryRawFoilList(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(rawFoilService.queryRawFoilList(whereJson), HttpStatus.OK); + HttpContext ctx = new HttpContext("11"); + ctx.setPage((String) (whereJson.get("page"))); + ctx.setRows((String) (whereJson.get("size"))); + return new ResponseEntity<>(rawFoilService.queryRawFoilList(whereJson, ctx), HttpStatus.OK); } @PostMapping("/needEmptyAxis") @@ -55,8 +62,7 @@ public class RawFoilController { @Log("确认下卷") @ApiOperation("确认下卷") public ResponseEntity confirmBlanking(@RequestBody JSONObject whereJson) { - rawFoilService.confirmBlanking(whereJson); - return new ResponseEntity<>(HttpStatus.OK); + return new ResponseEntity<>(rawFoilService.confirmBlanking(whereJson), HttpStatus.OK); } @PostMapping("/finishBlanking") diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/HandleBakingService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/HandleBakingService.java index ef53194c7..5fb0d9532 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/HandleBakingService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/HandleBakingService.java @@ -2,7 +2,7 @@ package org.nl.wms.pda.mps.service; import com.alibaba.fastjson.JSONObject; -public interface BakingService { +public interface HandleBakingService { /** * 烘箱出入 @@ -12,11 +12,11 @@ public interface BakingService { JSONObject ovenInAndOut(JSONObject whereJson); /** - * 入冷却 + * 检测确认 * @param whereJson / * @return JSONObject */ - JSONObject inCoolIvt(JSONObject whereJson); + JSONObject checkConfirm(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java index 3d4925524..ca1fbfda7 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/RawFoilService.java @@ -2,6 +2,7 @@ package org.nl.wms.pda.mps.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import org.nl.modules.wql.core.content.HttpContext; public interface RawFoilService { @@ -16,14 +17,14 @@ public interface RawFoilService { * @param whereJson / * @return JSONObject */ - JSONObject queryRawFoil(JSONObject whereJson); + JSONObject queryRawFoil(JSONObject whereJson, HttpContext ctx); /** * 查询生箔工单 * @param whereJson / * @return JSONObject */ - JSONObject queryRawFoilList(JSONObject whereJson); + JSONObject queryRawFoilList(JSONObject whereJson, HttpContext ctx); /** * 呼叫空卷轴 @@ -37,7 +38,7 @@ public interface RawFoilService { * @param whereJson / * @return JSONObject */ - void confirmBlanking(JSONObject whereJson); + JSONObject confirmBlanking(JSONObject whereJson); /** * 下卷完成 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java index 5cd909667..f7b972b53 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/BakingServiceImpl.java @@ -70,7 +70,7 @@ public class BakingServiceImpl implements BakingService { if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空"); /* - * 根据点位判断是 冷却却入烘箱还是暂存区入烘箱 + * 根据点位判断是 冷却区入烘箱还是暂存区入烘箱 */ JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonPointZc)) { @@ -94,19 +94,22 @@ public class BakingServiceImpl implements BakingService { InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); - // 3.插入明细明细 - JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + container_name + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在"); + // 3.插入主表 + JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); + JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); JSONObject hotParam = new JSONObject(); hotParam.put("container_name", container_name); + hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + hotParam.put("material_id", jsonMater.getString("material_id")); + hotParam.put("qty", jsonRaw.get("productin_qty")); + hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); hotParam.put("task_id", task_id); - hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); hotParam.put("start_point_code", point_code1); hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); hotParam.put("temperature", temperature); hotParam.put("oven_time", hours); - this.createHotDtl(hotParam); + this.createHotIoMst(hotParam); } else { /* * 冷却区入烘箱 @@ -187,27 +190,24 @@ public class BakingServiceImpl implements BakingService { InHotTask inHotTask = new InHotTask(); String task_id = inHotTask.createTask(param); - // 4.插入烘箱区出入主表 和 明细表 + // 4.插入烘箱区出入主表 JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); JSONObject hotParam = new JSONObject(); hotParam.put("container_name", container_name); - hotParam.put("task_id", task_id); hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); - hotParam.put("material_id", jsonMater.get("material_id")); - hotParam.put("qty", jsonMater.get("productin_qty")); - hotParam.put("qty_unit_id", jsonMater.get("base_unit_id")); - // 创建主表 - String iostorinv_id = this.createHotIoMst(hotParam); - // 创建明细 - hotParam.put("iostorinv_id", iostorinv_id); - hotParam.put("start_point_code", point_code2); + hotParam.put("material_id", jsonMater.getString("material_id")); + hotParam.put("qty", jsonRaw.get("productin_qty")); + hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); + hotParam.put("task_id", task_id); + hotParam.put("start_point_code", point_code1); hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); hotParam.put("temperature", temperature); hotParam.put("oven_time", hours); - this.createHotDtl(hotParam); + this.createHotIoMst(hotParam); + // 生成冷却区出入表 Long currentUserId = 2L; @@ -416,13 +416,21 @@ public class BakingServiceImpl implements BakingService { jsonHotMst.put("workorder_id", param.getString("workorder_id")); jsonHotMst.put("material_id", param.get("material_id")); jsonHotMst.put("qty", param.getString("qty")); - jsonHotMst.put("bill_status", "10"); + jsonHotMst.put("bill_status", "50"); jsonHotMst.put("qty_unit_id", param.getString("qty_unit_id")); + jsonHotMst.put("start_point_code", param.getString("start_point_code")); + jsonHotMst.put("end_point_code", param.getString("end_point_code")); jsonHotMst.put("create_mode", "03"); jsonHotMst.put("task_id", param.getString("task_id")); + jsonHotMst.put("task_type", param.getString("task_type")); + jsonHotMst.put("temperature", param.getString("temperature")); + jsonHotMst.put("oven_time", param.getString("oven_time")); jsonHotMst.put("create_id", 2); jsonHotMst.put("create_name", "mes用户"); jsonHotMst.put("create_time", DateUtil.now()); + jsonHotMst.put("confirm_optid", 2); + jsonHotMst.put("confirm_optname", "mes用户"); + jsonHotMst.put("confirm_time", DateUtil.now()); hotMstTab.insert(jsonHotMst); return jsonHotMst.getString("iostorinv_id"); @@ -436,8 +444,8 @@ public class BakingServiceImpl implements BakingService { WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表 JSONObject jsonHotDtl = new JSONObject(); - jsonHotDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId()); - jsonHotDtl.put("iostorinv_id", param.getString("iostorinv_id")); + jsonHotDtl.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonHotDtl.put("bill_code", ""); jsonHotDtl.put("start_point_code", param.getString("start_point_code")); jsonHotDtl.put("next_point_code", param.getString("next_point_code")); jsonHotDtl.put("temperature", param.getString("temperature")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java index f7b972b53..3dfad6099 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java @@ -9,12 +9,12 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.modules.common.exception.BadRequestException; -import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.pda.mps.eum.RegionTypeEnum; import org.nl.wms.pda.mps.service.BakingService; +import org.nl.wms.pda.mps.service.HandleBakingService; import org.nl.wms.sch.tasks.InCoolIvtTask; import org.nl.wms.sch.tasks.InHotTask; import org.nl.wms.sch.tasks.OutHotTask; @@ -24,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @Slf4j -public class BakingServiceImpl implements BakingService { +public class HandleBakingServiceImpl implements HandleBakingService { /* * 业务流程: @@ -56,254 +56,155 @@ public class BakingServiceImpl implements BakingService { WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 + // 入箱 + String container_name = whereJson.getString("container_name"); // 母卷号 + String temperature = whereJson.getString("temperature"); // 温度 + String hours = whereJson.getString("hours"); // 时间 + String point_code1 = whereJson.getString("point_code"); // 起点 + String next_point_code = whereJson.getString("next_point_code"); // 终点 + + Long currentUserId = 2L; + String currentUsername = "默认用户"; + + JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); + JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); if (StrUtil.equals(option, "1")) { - // 入箱 - String container_name = whereJson.getString("container_name"); // 母卷号 - String temperature = whereJson.getString("temperature"); // 温度 - String hours = whereJson.getString("hours"); // 时间 - String point_code1 = whereJson.getString("point_code"); // 点位 + if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空"); if (ObjectUtil.isEmpty(temperature)) throw new BadRequestException("温度不能为空"); if (ObjectUtil.isEmpty(hours)) throw new BadRequestException("时间不能为空"); - if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空"); + if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("起点不能为空!"); + if (ObjectUtil.isEmpty(next_point_code)) throw new BadRequestException("终点不能为空"); - /* - * 根据点位判断是 冷却区入烘箱还是暂存区入烘箱 - */ - JSONObject jsonPointZc = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonPointZc)) { - /* - * 暂存区入烘箱 - */ - // 1.查询烘箱对应的空位 - JSONObject jsonMap = new JSONObject(); - jsonMap.put("flag", "1"); - jsonMap.put("product_area",jsonPointZc.getString("product_area")); - jsonMap.put("temperature",temperature); - jsonMap.put("point_location",jsonPointZc.getString("point_location")); - JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); - // 2.创建暂存位 --> 烘烤区任务 - JSONObject param = new JSONObject(); - param.put("type", "2"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 - param.put("point_code1", point_code1); - param.put("point_code2", jsonHotIvt.getString("point_code")); + //插入冷却区出入库单表 + // 生成冷却区出入表 + JSONObject jsonCool = new JSONObject(); + jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); + jsonCool.put("io_type", "1"); + jsonCool.put("material_id", jsonMater.getString("material_id")); + jsonCool.put("pcsn", container_name); + jsonCool.put("bill_status", "50"); + jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id")); + jsonCool.put("start_point_code", point_code1); + jsonCool.put("end_point_code", next_point_code); + jsonCool.put("create_mode", "03"); + jsonCool.put("create_id", currentUserId); + jsonCool.put("create_name", currentUsername); + jsonCool.put("create_time", DateUtil.now()); + jsonCool.put("update_optid", currentUserId); + jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_time", DateUtil.now()); + jsonCool.put("confirm_optid", currentUserId); + jsonCool.put("confirm_optname", currentUsername); + jsonCool.put("confirm_time", DateUtil.now()); + coolTab.insert(jsonCool); - InHotTask inHotTask = new InHotTask(); - String task_id = inHotTask.createTask(param); + // 更新冷却区库存状态 + JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0); - // 3.插入主表 - JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); - JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); - - JSONObject hotParam = new JSONObject(); - hotParam.put("container_name", container_name); - hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); - hotParam.put("material_id", jsonMater.getString("material_id")); - hotParam.put("qty", jsonRaw.get("productin_qty")); - hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); - hotParam.put("task_id", task_id); - hotParam.put("start_point_code", point_code1); - hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); - hotParam.put("temperature", temperature); - hotParam.put("oven_time", hours); - this.createHotIoMst(hotParam); - } else { - /* - * 冷却区入烘箱 - */ - - // 1.根据冷却区此母卷的点位找到对应的暂存区、找到空位 -// JSONObject jsonCoolIvt = coolIvtTab.query("container_name ='" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); - JSONObject jsonCoolIvt = coolIvtTab.query("full_point_code = '" + point_code1 + "'and container_name = '" + container_name + "' and is_used = '1' and full_point_status = '02' and cool_ivt_status = '01'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("点位不存在或母卷不存在"); - - String product_area = jsonCoolIvt.getString("product_area"); // 生产区域 - String point_location = jsonCoolIvt.getString("point_location"); // 位置 - String reging_id = ""; - - switch (product_area) { - case "A1": - reging_id = RegionTypeEnum.A_HKZC.getId(); - break; - case "A2": - reging_id = RegionTypeEnum.B_HKZC.getId(); - break; - case "A3": - reging_id = RegionTypeEnum.C_HKZC.getId(); - break; - case "A4": - reging_id = RegionTypeEnum.D_HKZC.getId(); - break; - } - JSONObject map = new JSONObject(); - map.put("flag", "1"); - map.put("reging_id", reging_id); - map.put("point_location", point_location); - - JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0); - if (ObjectUtil.isEmpty(pointArr)) { - if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); - if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); - pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0); - - if (ObjectUtil.isEmpty(pointArr)) throw new BadRequestException("没有空暂存位"); - } - - // 2.判断暂存位是否有任务:找到无任务的暂存位 、查询烘箱对应的空位 - String point_code2 = ""; - for (int i = 0; i < pointArr.size(); i++) { - JSONObject jsonPoint = pointArr.getJSONObject(i); - String point_code = jsonPoint.getString("point_code"); - - JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) { - point_code2 = point_code; - break; - } - } - if (ObjectUtil.isEmpty(point_code2)) throw new BadRequestException("没有空暂存位"); - - // 查询烘箱对应的空位 - - JSONObject jsonMap = new JSONObject(); - jsonMap.put("flag", "1"); - jsonMap.put("product_area",product_area); - jsonMap.put("temperature",temperature); - jsonMap.put("point_location",map.getString("point_location")); - JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有对应空位"); - - // 3.创建冷却区 --> 烘烤区任务 - JSONObject param = new JSONObject(); - param.put("type", "1"); // 1- 冷却区入烘箱 2- 暂存位入烘箱 - param.put("point_code1", point_code1); - param.put("point_code2", point_code2); - param.put("point_code3", jsonHotIvt.getString("point_code")); - - // 创建冷却区 --> 暂存位的任务 - InHotTask inHotTask = new InHotTask(); - String task_id = inHotTask.createTask(param); - - // 4.插入烘箱区出入主表 - JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); - JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); - - JSONObject hotParam = new JSONObject(); - hotParam.put("container_name", container_name); - hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); - hotParam.put("material_id", jsonMater.getString("material_id")); - hotParam.put("qty", jsonRaw.get("productin_qty")); - hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); - hotParam.put("task_id", task_id); - hotParam.put("start_point_code", point_code1); - hotParam.put("next_point_code", jsonHotIvt.getString("point_code")); - hotParam.put("temperature", temperature); - hotParam.put("oven_time", hours); - this.createHotIoMst(hotParam); + jsonCoolIvt.put("full_point_status", "01"); + jsonCoolIvt.put("container_name", ""); + jsonCoolIvt.put("workorder_id", ""); + jsonCoolIvt.put("ivt_qty", "0"); + jsonCoolIvt.put("instorage_time", ""); + jsonCoolIvt.put("update_optid", currentUserId); + jsonCoolIvt.put("update_optname", currentUsername); + jsonCoolIvt.put("update_time", DateUtil.now()); + coolIvtTab.update(jsonCoolIvt); - // 生成冷却区出入表 - Long currentUserId = 2L; - String currentUsername = "mes用户"; + //生成烘箱出入库表 - JSONObject jsonCool = new JSONObject(); - jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); - jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); - jsonCool.put("io_type", "1"); - jsonCool.put("material_id", jsonMater.getString("material_id")); - jsonCool.put("pcsn", container_name); - jsonCool.put("bill_status", "10"); - jsonCool.put("task_id", task_id); - jsonCool.put("qty_unit_id", jsonMater.getString("base_unit_id")); - jsonCool.put("start_point_code", point_code1); - jsonCool.put("end_point_code", jsonHotIvt.getString("point_code")); - jsonCool.put("create_mode", "03"); - jsonCool.put("create_id", currentUserId); - jsonCool.put("create_name", currentUsername); - jsonCool.put("create_time", DateUtil.now()); - jsonCool.put("update_optid", currentUserId); - jsonCool.put("update_optname", currentUsername); - jsonCool.put("update_time", DateUtil.now()); - jsonCool.put("confirm_optid", currentUserId); - jsonCool.put("confirm_optname", currentUsername); - jsonCool.put("confirm_time", DateUtil.now()); - coolTab.insert(jsonCool); - } - } else if (StrUtil.equals(option, "2")) { - // 出箱 - String point_code1 = whereJson.getString("point_code"); - if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("出箱点位不能为空"); - JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("点位不存在"); - - // 1.查询暂存位有没有空位 - String product_area = jsonHotIvt.getString("product_area"); - String reging_id = ""; - switch (product_area) { - case "A1": - reging_id = RegionTypeEnum.A_HKZC.getId(); - break; - case "A2": - reging_id = RegionTypeEnum.B_HKZC.getId(); - break; - case "A3": - reging_id = RegionTypeEnum.C_HKZC.getId(); - break; - case "A4": - reging_id = RegionTypeEnum.D_HKZC.getId(); - break; - } - JSONObject map = new JSONObject(); - map.put("flag", "1"); - map.put("reging_id", reging_id); - map.put("point_location", jsonHotIvt.getString("point_location")); - - JSONArray pointArr = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().getResultJSONArray(0); - if (ObjectUtil.isEmpty(pointArr)) throw new BadRequestException("没有空暂存位"); - - // 2.判断暂存位是否有任务:找到无任务的暂存位 - String point_code2 = ""; - for (int i = 0; i < pointArr.size(); i++) { - JSONObject jsonPoint = pointArr.getJSONObject(i); - String point_code = jsonPoint.getString("point_code"); - - JSONObject json_point_code1 = taskTab.query("point_code1 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code2 = taskTab.query("point_code2 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code3 = taskTab.query("point_code3 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - JSONObject json_point_code4 = taskTab.query("point_code4 = '" + point_code + "' and task_status != '07' and is_delete = '0'").uniqueResult(0); - if (ObjectUtil.isEmpty(json_point_code1) && ObjectUtil.isEmpty(json_point_code2) && ObjectUtil.isEmpty(json_point_code3) && ObjectUtil.isEmpty(json_point_code4)) { - point_code2 = point_code; - break; - } - } - if (ObjectUtil.isEmpty(point_code2)) throw new BadRequestException("没有空暂存位"); - // 3.创建任务 - JSONObject param = new JSONObject(); - param.put("point_code1", point_code1); - param.put("point_code2", point_code2); - param.put("material_code", jsonHotIvt.getString("container_name")); - OutHotTask outHotTask = new OutHotTask(); - String task_id = outHotTask.createTask(param); - - // 4.插入烘箱区出入明细表 - JSONObject jsonHotReMst = hosReMstTab.query("container_name = '" + jsonHotIvt.getString("container_name") + "' and bill_status <> '50' and is_delete = '0'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotReMst)) throw new BadRequestException("烘箱区出入主表不存在"); - - // 创建明细 JSONObject hotParam = new JSONObject(); - hotParam.put("task_id", task_id); - hotParam.put("iostorinv_id", jsonHotReMst.getString("iostorinv_id")); + hotParam.put("container_name", container_name); + hotParam.put("io_type", "0"); + hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + hotParam.put("material_id", jsonMater.getString("material_id")); + hotParam.put("qty", jsonRaw.get("productin_qty")); + hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); hotParam.put("start_point_code", point_code1); - hotParam.put("next_point_code", point_code2); - hotParam.put("temperature", jsonHotIvt.getString("temperature")); - this.createHotDtl(hotParam); + hotParam.put("next_point_code", next_point_code); + hotParam.put("temperature", temperature); + hotParam.put("oven_time", hours); + this.createHotIoMst(hotParam); + + // 更新烘箱区库存状态 + JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + next_point_code + "'").uniqueResult(0); + jsonHotIvt.put("point_status", "02"); + jsonHotIvt.put("container_name", container_name); + jsonHotIvt.put("workorder_id", jsonRaw.getString("workorder_id")); + jsonHotIvt.put("ivt_qty", jsonRaw.getString("productin_qty")); + jsonHotIvt.put("instorage_time", DateUtil.now()); + jsonHotIvt.put("update_optid", currentUserId); + jsonHotIvt.put("update_optname", currentUsername); + jsonHotIvt.put("update_time", DateUtil.now()); + hosIvtTab.update(jsonHotIvt); + + } else if (StrUtil.equals(option, "2")) { + + //插入烘箱出入库记录表 + JSONObject hotParam = new JSONObject(); + hotParam.put("container_name", container_name); + hotParam.put("io_type", "1"); + hotParam.put("workorder_id", jsonRaw.getString("workorder_id")); + hotParam.put("material_id", jsonMater.getString("material_id")); + hotParam.put("qty", jsonRaw.get("productin_qty")); + hotParam.put("qty_unit_id", jsonMater.getString("base_unit_id")); + hotParam.put("start_point_code", point_code1); + hotParam.put("next_point_code", next_point_code); + hotParam.put("temperature", temperature); + hotParam.put("oven_time", hours); + this.createHotIoMst(hotParam); + + //维护烘箱库存信息 + JSONObject jsonHotIvt = hosIvtTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); + // 更新烘箱区库存状态 + jsonHotIvt.put("point_status", "01"); + jsonHotIvt.put("container_name", ""); + jsonHotIvt.put("workorder_id", ""); + jsonHotIvt.put("ivt_qty", 0); + jsonHotIvt.put("instorage_time", ""); + jsonHotIvt.put("update_optid", currentUserId); + jsonHotIvt.put("update_optname", currentUsername); + jsonHotIvt.put("update_time", DateUtil.now()); + hosIvtTab.update(jsonHotIvt); + + //生成冷却区入库记录 + JSONObject jsonCool = new JSONObject(); + jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); + jsonCool.put("io_type", "0"); + jsonCool.put("material_id", jsonMater.getString("material_id")); + jsonCool.put("pcsn", container_name); + jsonCool.put("bill_status", "10"); + jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id")); + jsonCool.put("start_point_code", point_code1); + jsonCool.put("end_point_code", next_point_code); + jsonCool.put("create_mode", "03"); + jsonCool.put("create_id", currentUserId); + jsonCool.put("create_name", currentUsername); + jsonCool.put("create_time", DateUtil.now()); + jsonCool.put("update_optid", currentUserId); + jsonCool.put("update_optname", currentUsername); + jsonCool.put("update_time", DateUtil.now()); + jsonCool.put("confirm_optid", currentUserId); + jsonCool.put("confirm_optname", currentUsername); + jsonCool.put("confirm_time", DateUtil.now()); + coolTab.insert(jsonCool); + + //更新冷却区库存 + JSONObject jsonIvt = coolIvtTab.query("full_point_code ='" + next_point_code + "'").uniqueResult(0); + jsonIvt.put("full_point_status", "02"); + jsonIvt.put("cool_ivt_status", "03"); + jsonIvt.put("instorage_time", DateUtil.now()); + jsonIvt.put("container_name", jsonRaw.getString("container_name")); + jsonIvt.put("workorder_id", jsonRaw.getString("workorder_id")); + jsonIvt.put("ivt_qty", jsonRaw.getString("productin_qty")); + coolIvtTab.update(jsonIvt); } JSONObject result = new JSONObject(); result.put("message", "操作成功!"); @@ -312,90 +213,24 @@ public class BakingServiceImpl implements BakingService { @Override @Transactional - public JSONObject inCoolIvt(JSONObject whereJson) { - WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位点 - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 - WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱出入主表 - WQLObject coolTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 - WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 - WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表 + public JSONObject checkConfirm(JSONObject whereJson) { + String point_code = whereJson.getString("point_code"); + String container_name = whereJson.getString("container_name"); - - String point_code1 = whereJson.getString("point_code"); // 暂存位:起点 - String container_name = whereJson.getString("container_name"); // 母卷号 - - if (ObjectUtil.isEmpty(point_code1)) throw new BadRequestException("点位不能为空"); - if (ObjectUtil.isEmpty(container_name)) throw new BadRequestException("母卷号不能为空"); - - // 1.获取此暂存位的生产区域和上下位置 - JSONObject jsonPoint = pointTab.query("point_code = '" + point_code1 + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonPoint)) throw new BadRequestException("点位不存在"); - - // 2.找冷却区空货位 - JSONObject map = new JSONObject(); - map.put("flag", "2"); - map.put("product_area", jsonPoint.getString("product_area")); - map.put("point_location", jsonPoint.getString("point_location")); - - JSONObject jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); - // 如果为空 - if (ObjectUtil.isEmpty(jsonCooIvt)) { - if (StrUtil.equals(jsonPoint.getString("point_location"), "0")) map.put("point_location", "1"); - if (StrUtil.equals(jsonPoint.getString("point_location"), "1")) map.put("point_location", "0"); - jsonCooIvt = WQL.getWO("PDA_OVENINANDOUT_01").addParamMap(map).process().uniqueResult(0); + if (StrUtil.isEmpty(point_code)){ + throw new BadRequestException("点位不能为空!"); + } + if (StrUtil.isEmpty(container_name)){ + throw new BadRequestException("母卷不能为空!"); } - if (ObjectUtil.isEmpty(jsonCooIvt)) throw new BadRequestException("冷却区空位不足"); - // 3.创建任务 - JSONObject param = new JSONObject(); - param.put("point_code1", point_code1); - param.put("point_code2", jsonCooIvt.getString("full_point_code")); - param.put("container_name", container_name); + JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '"+point_code+"'").uniqueResult(0); + String on_container_name = cool_ivt.getString("on_container_name"); + if (!on_container_name.equals(container_name)){ + throw new BadRequestException("点位上子卷不符!"); + } - - InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(); - String task_id = inCoolIvtTask.createTask(param); - - // 4.插入明细 - JSONObject jsonHotMst = hotMstTab.query("container_name = '" + container_name + "' and is_delete = '0' and bill_status <> '50'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonHotMst)) throw new BadRequestException("烘烤区出入主表不存在"); - JSONObject hotParam = new JSONObject(); - hotParam.put("task_id", task_id); - hotParam.put("iostorinv_id", jsonHotMst.getString("iostorinv_id")); - hotParam.put("start_point_code", point_code1); - hotParam.put("next_point_code", jsonCooIvt.getString("full_point_code")); - this.createHotDtl(hotParam); - - // 生成冷却区出入表 - Long currentUserId = 2L; - String currentUsername = "mes用户"; - - JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0); - JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在"); - - JSONObject jsonCool = new JSONObject(); - jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); - jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); - jsonCool.put("io_type", "0"); - jsonCool.put("material_id", jsonMater.getString("material_id")); - jsonCool.put("pcsn", container_name); - jsonCool.put("bill_status", "10"); - jsonCool.put("qty_unit_id", jsonMater.get("base_unit_id")); - jsonCool.put("task_id", task_id); - jsonCool.put("start_point_code", point_code1); - jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code")); - jsonCool.put("create_mode", "03"); - jsonCool.put("create_id", currentUserId); - jsonCool.put("create_name", currentUsername); - jsonCool.put("create_time", DateUtil.now()); - jsonCool.put("update_optid", currentUserId); - jsonCool.put("update_optname", currentUsername); - jsonCool.put("update_time", DateUtil.now()); - jsonCool.put("confirm_optid", currentUserId); - jsonCool.put("confirm_optname", currentUsername); - jsonCool.put("confirm_time", DateUtil.now()); - coolTab.insert(jsonCool); + cool_ivt.put("cool_ivt_status","04"); JSONObject result = new JSONObject(); result.put("message", "操作成功!"); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/OutServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/OutServiceImpl.java index 9311e94f0..a17453c58 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/OutServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/OutServiceImpl.java @@ -37,8 +37,8 @@ public class OutServiceImpl implements OutService { } JSONArray rows = WQL.getWO("PDA_02").addParamMap(map).process().getResultJSONArray(0); JSONObject jo = new JSONObject(); - jo.put("data",rows); - jo.put("message","查询成功!"); + jo.put("data", rows); + jo.put("message", "查询成功!"); return jo; } @@ -52,7 +52,7 @@ public class OutServiceImpl implements OutService { JSONArray rows = whereJson.getJSONArray("cut_rows"); - if (rows.size()>2){ + if (rows.size() > 2) { throw new BadRequestException("最多选择两个子卷进行操作!"); } @@ -65,30 +65,30 @@ public class OutServiceImpl implements OutService { //对子卷任务进行校验 for (int i = 0; i < rows.size(); i++) { - JSONObject row = rows.getJSONObject(i); - if (StrUtil.isEmpty(split_group)){ + JSONObject row = rows.getJSONObject(i); + if (StrUtil.isEmpty(split_group)) { split_group = row.getString("split_group"); resource_name = row.getString("resource_name"); order_type = row.getString("order_type"); - if (order_type.equals("1")){ + if (order_type.equals("1")) { parent_container_name = row.getString("parent_container_name"); - }else { + } else { restruct_container_name = row.getString("restruct_container_name"); package_box_sn = row.getString("package_box_sn"); } - }else { - if (!split_group.equals(row.getString("split_group"))){ + } else { + if (!split_group.equals(row.getString("split_group"))) { throw new BadRequestException("两个子卷的分切组必须相同!"); } - if (!resource_name.equals(row.getString("resource_name"))){ + if (!resource_name.equals(row.getString("resource_name"))) { throw new BadRequestException("两个子卷的机台编号必须相同!"); } - if (order_type.equals("1")){ - if (!parent_container_name.equals(row.getString("parent_container_name"))){ + if (order_type.equals("1")) { + if (!parent_container_name.equals(row.getString("parent_container_name"))) { throw new BadRequestException("两个子卷的母卷号必须相同!"); } - }else { - if (!restruct_container_name.equals(row.getString("restruct_container_name")) || !package_box_sn.equals(row.getString("package_box_sn"))){ + } else { + if (!restruct_container_name.equals(row.getString("restruct_container_name")) || !package_box_sn.equals(row.getString("package_box_sn"))) { throw new BadRequestException("两个子卷的改制子卷必须相同!"); } } @@ -96,20 +96,20 @@ public class OutServiceImpl implements OutService { } //查询该点位对应的机台编号 - JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='"+point_code+"' OR down_point_code ='"+point_code+"'").uniqueResult(0); + JSONObject cut_ivt = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("up_point_code ='" + point_code + "' OR down_point_code ='" + point_code + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(cut_ivt)){ + if (ObjectUtil.isEmpty(cut_ivt)) { throw new BadRequestException("未查询到对应的分切机!"); } String cut_qzzno = rows.getJSONObject(0).getString("qzzno"); //判断是否末次下卷 - if (is_last.equals("1")){ + if (is_last.equals("1")) { //查询该分切机邻近位置的空载具的输送线点位 JSONObject empty_vehicle = WQL.getWO("PDA_02") .addParam("sort_seq", cut_ivt.getString("sort_seq")) - .addParam("sql_str", " ORDER BY abs("+cut_ivt.getString("sort_seq")+"-sort_seq),point_code") + .addParam("sql_str", " ORDER BY abs(" + cut_ivt.getString("sort_seq") + "-sort_seq),point_code") .addParam("product_area", cut_ivt.getString("product_area")) .addParam("point_location", cut_ivt.getString("point_location")) .addParam("flag", "3").process().uniqueResult(0); @@ -118,78 +118,78 @@ public class OutServiceImpl implements OutService { } JSONObject jo = new JSONObject(); - jo.put("point_code1",point_code); - jo.put("point_code2",empty_vehicle.getString("point_code")); - jo.put("vehicle_code",cut_qzzno); - jo.put("task_type","010404"); + jo.put("point_code1", point_code); + jo.put("point_code2", empty_vehicle.getString("point_code")); + jo.put("vehicle_code", cut_qzzno); + jo.put("task_type", "010404"); cutTrussTask.createTask(jo); - }else { + } else { String ext_code = cut_ivt.getString("ext_code"); //查询该机台编号已经配送完成,套轴完成但是未完成的分切计划 - JSONObject slitting = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("resource_name = '"+ext_code+"' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND status = '03'").uniqueResult(0); + JSONObject slitting = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("resource_name = '" + ext_code + "' AND is_child_tz_ok = '1' AND is_child_ps_ok = '1' AND status = '03'").uniqueResult(0); - if (ObjectUtil.isEmpty(slitting)){ + if (ObjectUtil.isEmpty(slitting)) { throw new BadRequestException("该分切机没有对应完成配送完成的气涨轴!"); } String qzzno = slitting.getString("qzzno"); //查询该气涨轴所在输送线位置 - JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("qzzno = '"+qzzno+"' AND point_status = '03'").uniqueResult(0); - if (ObjectUtil.isEmpty(delivery_point)){ + JSONObject delivery_point = WQLObject.getWQLObject("ST_IVT_DeliveryPointIvt").query("qzzno = '" + qzzno + "' AND point_status = '03'").uniqueResult(0); + if (ObjectUtil.isEmpty(delivery_point)) { throw new BadRequestException("未查询到对应的输送线点位!"); } JSONObject jo = new JSONObject(); - jo.put("point_code1",delivery_point.getString("point_code")); - jo.put("point_code2",point_code); - jo.put("point_code3",point_code); - jo.put("point_code4",delivery_point.getString("point_code")); - jo.put("vehicle_code",delivery_point.getString("qzzno")); - jo.put("vehicle_code2",cut_qzzno); - jo.put("task_type","010403"); + jo.put("point_code1", point_code); + jo.put("point_code2", delivery_point.getString("point_code")); + jo.put("point_code3", delivery_point.getString("point_code")); + jo.put("point_code4", point_code); + jo.put("vehicle_code", delivery_point.getString("qzzno")); + jo.put("vehicle_code2", cut_qzzno); + jo.put("task_type", "010403"); cutTrussTask.createTask(jo); } JSONObject result = new JSONObject(); - result.put("message","操作成功!"); + result.put("message", "操作成功!"); return result; } @Override public JSONObject conveyPointQuery(JSONObject whereJson) { String product_area = whereJson.getString("product_area"); - HashMap map = new HashMap<>(); - map.put("flag","10"); - if (StrUtil.isNotEmpty(product_area)){ - map.put("product_area",product_area); + HashMap map = new HashMap<>(); + map.put("flag", "10"); + if (StrUtil.isNotEmpty(product_area)) { + map.put("product_area", product_area); } - JSONArray deliver_rows = WQL.getWO("PDA_02").addParam("product_area",product_area).addParam("flag","").process().getResultJSONArray(0); + JSONArray deliver_rows = WQL.getWO("PDA_02").addParam("product_area", product_area).addParam("flag", "").process().getResultJSONArray(0); JSONObject jo = new JSONObject(); - jo.put("data",deliver_rows); - jo.put("message","查询成功!"); + jo.put("data", deliver_rows); + jo.put("message", "查询成功!"); return jo; } @Override public JSONObject conveyConfirm(JSONObject whereJson) { String point_code = whereJson.getString("point_code"); - if (StrUtil.isEmpty(point_code)){ + if (StrUtil.isEmpty(point_code)) { throw new BadRequestException("起点不能为空!"); } //如果查询到给ACS下发一个输送线任务 JSONObject form = new JSONObject(); - form.put("point_code1",point_code); - form.put("point_code2","SS01"); - form.put("task_type","010401"); + form.put("point_code1", point_code); + form.put("point_code2", "SS01"); + form.put("task_type", "010401"); CutConveyorTask cutConveyorTask = new CutConveyorTask(); cutConveyorTask.createTask(form); JSONObject jo = new JSONObject(); - jo.put("message","查询成功!"); + jo.put("message", "查询成功!"); return jo; } 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 5208c218e..09141446c 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 @@ -15,6 +15,7 @@ import org.nl.modules.common.utils.SecurityUtils; import org.nl.modules.system.util.CodeUtil; import org.nl.modules.wql.WQL; import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.modules.wql.core.content.HttpContext; import org.nl.wms.ext.acs.service.AcsToWmsService; import org.nl.wms.ext.acs.service.impl.WmsToAcsServiceImpl; import org.nl.wms.pda.mps.service.RawFoilService; @@ -44,7 +45,7 @@ public class RawFoilServiceImpl implements RawFoilService { } @Override - public JSONObject queryRawFoil(JSONObject whereJson) { + public JSONObject queryRawFoil(JSONObject whereJson, HttpContext ctx) { String point_code = whereJson.getString("point_code"); String container_name = whereJson.getString("container_name"); String product_area = whereJson.getString("product_area"); @@ -61,10 +62,11 @@ public class RawFoilServiceImpl implements RawFoilService { map.put("product_area", "A1"); }*/ - JSONArray arr = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().getResultJSONArray(0); - for (int i = 0; i < arr.size(); i++) { + JSONObject arr = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).pageQuery(ctx,"container_name"); + JSONArray rows = arr.getJSONArray("content"); + for (int i = 0; i < rows.size(); i++) { JSONObject json = new JSONObject(); - JSONObject jsonObject = arr.getJSONObject(i); + JSONObject jsonObject = rows.getJSONObject(i); String theory_height = jsonObject.getString("theory_height"); String eqp_velocity = jsonObject.getString("eqp_velocity"); @@ -84,9 +86,9 @@ public class RawFoilServiceImpl implements RawFoilService { if (betweenDay > 0) { json.put("color_type", "1"); - }else if(betweenDay <= 0 && betweenDay >= -30) { + } else if (betweenDay <= 0 && betweenDay >= -30) { json.put("color_type", "2"); - }else { + } else { json.put("color_type", "0"); } @@ -102,20 +104,22 @@ public class RawFoilServiceImpl implements RawFoilService { } JSONObject jo = new JSONObject(); jo.put("data", resultArr); + jo.put("size",arr.getString("totalElements")); jo.put("message", "查询成功!"); return jo; - + } @Override - public JSONObject queryRawFoilList(JSONObject whereJson) { + public JSONObject queryRawFoilList(JSONObject whereJson, HttpContext ctx) { JSONObject map = new JSONObject(); map.put("flag", "5"); map.put("point_code", whereJson.getString("point_code")); map.put("container_name", whereJson.getString("container_name")); - JSONArray resultJSONArray = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().getResultJSONArray(0); + JSONObject resultJSONArray = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).pageQuery(ctx,"container_name"); JSONObject jo = new JSONObject(); - jo.put("data", resultJSONArray); + jo.put("data", resultJSONArray.getJSONArray("content")); + jo.put("size",resultJSONArray.getString("totalElements")); jo.put("message", "查询成功!"); return jo; } @@ -124,10 +128,7 @@ public class RawFoilServiceImpl implements RawFoilService { @Transactional(rollbackFor = Exception.class) public JSONObject needEmptyAxis(JSONObject whereJson) { - WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单表 - WQLObject regionTab = WQLObject.getWQLObject("ST_IVT_CoolRegionIO"); // 冷却区出入表 - WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料信息表 WQLObject sbTab = WQLObject.getWQLObject("ST_IVT_SbPointIvt"); // 生箔点位库存表 @@ -139,6 +140,7 @@ public class RawFoilServiceImpl implements RawFoilService { if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("生箔点位不存在"); String start_pint_code = ""; + String point_code4 = ""; // 2.根据就近原则查对应空卷抽 JSONObject map = new JSONObject(); map.put("flag", "1"); @@ -147,43 +149,16 @@ public class RawFoilServiceImpl implements RawFoilService { JSONObject jsonIvt = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); // 3.如果没找到则继续找下一节点 if (ObjectUtil.isEmpty(jsonIvt)) { - String point_location = jsonSb.getString("point_location"); + /*String point_location = jsonSb.getString("point_location"); if (StrUtil.equals(point_location, "0")) map.put("point_location", "1"); if (StrUtil.equals(point_location, "1")) map.put("point_location", "0"); - JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0); - - if (ObjectUtil.isEmpty(jsonIvt_tow)) throw new BadRequestException("没有空卷轴"); - start_pint_code = jsonIvt_tow.getString("empty_point_code"); + JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map).process().uniqueResult(0);*/ + throw new BadRequestException("未查询到可用点位"); } else { start_pint_code = jsonIvt.getString("empty_point_code"); + point_code4 = jsonIvt.getString("full_point_code"); } - //查询满轴存放点位 - // 2.根据就近原则查对应空卷抽 - String point_code4= ""; - JSONObject map4 = new JSONObject(); - map4.put("flag", "2"); - map4.put("product_area", jsonSb.getString("product_area")); - map4.put("point_location", jsonSb.getString("point_location")); - JSONObject jsonIvt4 = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map4).process().uniqueResult(0); - // 3.如果没找到则继续找下一节点 - if (ObjectUtil.isEmpty(jsonIvt4)) { - String point_location = jsonSb.getString("point_location"); - if (StrUtil.equals(point_location, "0")) { - map4.put("point_location", "1"); - } - if (StrUtil.equals(point_location, "1")) { - map4.put("point_location", "0"); - } - JSONObject jsonIvt_tow = WQL.getWO("PDA_RAWFOIL_01").addParamMap(map4).process().uniqueResult(0); - - if (ObjectUtil.isEmpty(jsonIvt_tow)) { - throw new BadRequestException("没有空位"); - } - point_code4 = jsonIvt_tow.getString("full_point_code"); - } else { - point_code4 = jsonIvt4.getString("full_point_code"); - } // 起点和终点确定 生成任务 JSONObject param = new JSONObject(); param.put("point_code1", start_pint_code); @@ -194,34 +169,7 @@ public class RawFoilServiceImpl implements RawFoilService { param.put("material_code", jsonRaw.getString("container_name")); CallEmpReelTask callEmpReelTask = new CallEmpReelTask(); - String task_id = callEmpReelTask.createTask(param); - - // 插入入库单 - Long currentUserId = SecurityUtils.getCurrentUserId(); - String currentUsername = SecurityUtils.getCurrentUsername(); - - JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); - if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在"); - - JSONObject jsonRegion = new JSONObject(); - jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); - jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); - jsonRegion.put("io_type", "1"); - jsonRegion.put("material_id", jsonMater.getString("material_id")); - jsonRegion.put("pcsn", jsonRaw.getString("container_name")); - jsonRegion.put("vehicle_code", ""); - jsonRegion.put("qty", jsonRaw.getString("productin_qty")); - jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id")); - jsonRegion.put("bill_status", "10"); - jsonRegion.put("start_point_code", jsonSb.getString("point_code")); - jsonRegion.put("end_point_code", point_code4); - jsonRegion.put("cust_id", ""); - jsonRegion.put("create_mode", "03"); - jsonRegion.put("task_id", task_id); - jsonRegion.put("create_id", currentUserId); - jsonRegion.put("create_name", currentUsername); - jsonRegion.put("create_time", DateUtil.now()); - regionTab.insert(jsonRegion); + callEmpReelTask.createTask(param); // 更新工单状态 jsonRaw.put("status", "02"); @@ -233,7 +181,7 @@ public class RawFoilServiceImpl implements RawFoilService { } @Override - public void confirmBlanking(JSONObject whereJson) { + public JSONObject confirmBlanking(JSONObject whereJson) { WQLObject rawTab = WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder"); // 生箔工单 WQLObject sbTab = WQLObject.getWQLObject("st_ivt_sbpointivt"); // 生箔点位库存表 @@ -244,7 +192,7 @@ public class RawFoilServiceImpl implements RawFoilService { //查询该母卷号对应的任务 String container_name = whereJson.getString("container_name"); - JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '"+container_name+"' and task_status <> '07'").uniqueResult(0); + JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '" + container_name + "' and task_status <> '07'").uniqueResult(0); // 查询生箔点位库存表 JSONObject jsonSb = sbTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0); @@ -261,12 +209,16 @@ public class RawFoilServiceImpl implements RawFoilService { JSONObject result = wmsToAcsService.updateTask(paramArr); if (!StrUtil.equals(result.getString("status"), "200")) { - throw new BadRequestException("操作失败:"+result.getString("message ")); + throw new BadRequestException("操作失败:" + result.getString("message ")); } // 更新工单状态为确认下卷 - jsonRaw.put("status","03"); + jsonRaw.put("status", "03"); rawTab.update(jsonRaw); + + JSONObject jo = new JSONObject(); + jo.put("message", "操作成功!"); + return jo; } @Override diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql index e58c87257..e219b68c5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/wql/PDA_RAWFOIL_01.wql @@ -51,6 +51,8 @@ ST_IVT_CoolPointIvt ivt WHERE ivt.empty_point_status = '02' + AND + ivt.full_point_status = '01' AND NOT EXISTS ( SELECT @@ -126,7 +128,7 @@ ENDIF IF 输入.flag = "4" - QUERY + PAGEQUERY SELECT der.* FROM @@ -148,11 +150,11 @@ ENDOPTION ENDSELECT - ENDQUERY + ENDPAGEQUERY ENDIF IF 输入.flag = "5" - QUERY + PAGEQUERY SELECT ( CASE @@ -176,7 +178,6 @@ der.product_area AS product_area, der.update_time AS update_time, ivt.point_location, - ivt.product_area, der.workorder_id FROM PDM_BI_RawFoilWorkOrder der @@ -194,7 +195,7 @@ ENDOPTION ENDSELECT - ENDQUERY + ENDPAGEQUERY ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/CoolInController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/CoolInController.java index 875677caa..4d4a16553 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/CoolInController.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/CoolInController.java @@ -47,4 +47,11 @@ public class CoolInController { return new ResponseEntity<>(coolInService.confirmInstor(whereJson),HttpStatus.OK); } + @PostMapping("/statusList") + @Log("状态下拉框") + @ApiOperation("状态下拉框") + public ResponseEntity statusList(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(coolInService.statusList(whereJson),HttpStatus.OK); + } + } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/CoolInService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/CoolInService.java index a15d4b181..1a76a96d2 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/CoolInService.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/CoolInService.java @@ -25,4 +25,11 @@ public interface CoolInService { * @return JSONObject / */ JSONObject confirmInstor(JSONObject whereJson); + + /** + * 状态下拉框 + * @param whereJson / + * @return JSONObject / + */ + JSONObject statusList(JSONObject whereJson); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/CoolInServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/CoolInServiceImpl.java index 3ef5d9563..ee585cf52 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/CoolInServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/CoolInServiceImpl.java @@ -62,9 +62,14 @@ public class CoolInServiceImpl implements CoolInService { String is_bake = whereJson.getString("is_bake"); // 是否烘烤完成 // 查询终点在冷却区是否存在 - JSONObject jsonCoolIvt = coolIvtTab.query("point_code = '" + point_code + "' and full_point_status = '01' and is_used = '1'").uniqueResult(0); + JSONObject jsonCoolIvt = coolIvtTab.query("point_code = '" + point_code + "' and full_point_status = '01' and empty_point_status = '01' and is_used = '1'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonCoolIvt)) throw new BadRequestException("此点位不存在或被占用"+point_code); + //查询该点位是否存在任务 + JSONObject task_jo = WQLObject.getWQLObject("").query("(point_code1 like '%"+jsonCoolIvt.getString("point_code")+"%' OR point_code2 like '%"+jsonCoolIvt.getString("point_code")+"%') AND is_delete = '0' AND task_status < '07'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(task_jo)){ + throw new BadRequestException("该点位存在未完成的任务,不允许绑定!"); + } /* // 插入冷却区出入库单据 JSONObject jsonCool = new JSONObject(); jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId()); @@ -90,12 +95,17 @@ public class CoolInServiceImpl implements CoolInService { JSONObject json = coolIvtTab.query("container_name = '" + raw_jo.getString("container_name") + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(json)) throw new BadRequestException("此母卷库存已存在"); + //查询对应母卷信息 + JSONObject mom_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '"+raw_jo.getString("container_name")+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(mom_jo)){ + throw new BadRequestException("未查询到该母卷对应工单!"); + } // 更新冷却区库存 jsonCoolIvt.put("full_point_status", "02"); - if (StrUtil.equals(is_bake, "0")) jsonCoolIvt.put("cool_ivt_status", "01"); - if (StrUtil.equals(is_bake, "1")) jsonCoolIvt.put("cool_ivt_status", "03"); + jsonCoolIvt.put("cool_ivt_status", is_bake); jsonCoolIvt.put("container_name", raw_jo.getString("container_name")); jsonCoolIvt.put("workorder_id", raw_jo.getString("workorder_id")); + jsonCoolIvt.put("ivt_qty", raw_jo.getString("productin_qty")); jsonCoolIvt.put("instorage_time", DateUtil.now()); jsonCoolIvt.put("update_optid", currentUserId); jsonCoolIvt.put("create_name", currentUsername); @@ -106,4 +116,13 @@ public class CoolInServiceImpl implements CoolInService { result.put("message", "入库成功!"); return result; } + + @Override + public JSONObject statusList(JSONObject whereJson) { + JSONArray rows = WQL.getWO("PDA_COOLIN").addParam("flag","2").process().getResultJSONArray(0); + JSONObject jo = new JSONObject(); + jo.put("data", rows); + jo.put("message", "查询成功!"); + return jo; + } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_COOLIN.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_COOLIN.wql index 3736d6414..8dd18747b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_COOLIN.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_COOLIN.wql @@ -79,3 +79,17 @@ ENDSELECT ENDPAGEQUERY ENDIF + + IF 输入.flag = "2" + QUERY + SELECT + label AS text, + value + FROM + sys_dict_detail + WHERE + dict_id = '115' + + ENDSELECT + ENDQUERY + ENDIF diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls index ec9cf12ec..7fe8287c6 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/pdm/wql/pdm.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java index 5f7853b7d..262f92ed0 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/CallEmpReelTask.java @@ -73,7 +73,7 @@ public class CallEmpReelTask extends AbstractAcsTask { taskTab.delete("task_id = '" + task_id + "'"); // 删除冷却区出入单据 - coolTab.delete("task_id = '"+task_id+"'"); + // coolTab.delete("task_id = '"+task_id+"'"); // 更新生箔工单状态为开始、清除称重信息 JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0); @@ -88,10 +88,10 @@ public class CallEmpReelTask extends AbstractAcsTask { jsonTask.put("update_time", DateUtil.now()); taskTab.update(jsonTask); - // 更新冷却区出入表 状态为执行中 + /*// 更新冷却区出入表 状态为执行中 JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); jsonCool.put("bill_status", "40"); - coolTab.update(jsonCool); + coolTab.update(jsonCool);*/ // 更新生箔工单称重信息 String weight = taskObj.getString("weight"); @@ -169,15 +169,32 @@ public class CallEmpReelTask extends AbstractAcsTask { ivtTab.update(jsonIvt2); } - // 更新冷却区出入表 - JSONObject jsonCool = coolTab.query("task_id = '" + task_id + "'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonCool)) { - jsonCool.put("bill_status", "50"); - jsonCool.put("confirm_optid", SecurityUtils.getCurrentUserId()); - jsonCool.put("confirm_optname", SecurityUtils.getCurrentUsername()); - jsonCool.put("confirm_time", DateUtil.now()); - coolTab.update(jsonCool); - } + // 插入入库单 + Long currentUserId = SecurityUtils.getCurrentUserId(); + String currentUsername = SecurityUtils.getCurrentUsername(); + + JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在"); + + JSONObject jsonRegion = new JSONObject(); + jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE")); + jsonRegion.put("io_type", "1"); + jsonRegion.put("material_id", jsonMater.getString("material_id")); + jsonRegion.put("pcsn", jsonRaw.getString("container_name")); + jsonRegion.put("vehicle_code", ""); + jsonRegion.put("qty", jsonRaw.getString("productin_qty")); + jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id")); + jsonRegion.put("bill_status", "50"); + jsonRegion.put("start_point_code", point_code2); + jsonRegion.put("end_point_code", point_code4); + jsonRegion.put("cust_id", ""); + jsonRegion.put("create_mode", "03"); + jsonRegion.put("task_id", task_id); + jsonRegion.put("create_id", currentUserId); + jsonRegion.put("create_name", currentUsername); + jsonRegion.put("create_time", DateUtil.now()); + coolTab.insert(jsonRegion); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java index c0ef42337..8ccab706e 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/tasks/InHotTask.java @@ -70,7 +70,7 @@ public class InHotTask extends AbstractAcsTask { String task_id = taskObj.getString("task_id"); JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "'").uniqueResult(0); - if (StrUtil.equals(status,"0")) { + if (StrUtil.equals(status, "0")) { // 判断此条明细是否是冷却区 -> 烘箱,是则删除主表 if (ObjectUtil.isNotEmpty(jsonTask.getString("point_code3"))) { @@ -78,18 +78,18 @@ public class InHotTask extends AbstractAcsTask { JSONObject jsonHotDtl = hotDtlTab.query("task_id = '" + task_id + "'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonHotDtl)) throw new BadRequestException("明细单据不存在"); - hotMstTab.delete("iostorinv_id = '"+jsonHotDtl.getString("iostorinv_id")+"'"); + hotMstTab.delete("iostorinv_id = '" + jsonHotDtl.getString("iostorinv_id") + "'"); // 删除冷却出入表 - coolIoTab.delete("task_id = '"+task_id+"'"); + coolIoTab.delete("task_id = '" + task_id + "'"); } // 取消删除任务 - taskTab.delete("task_id = '"+task_id+"'"); + taskTab.delete("task_id = '" + task_id + "'"); // 删除烘箱明细 - hotDtlTab.delete("task_id = '"+task_id+"'"); - } + hotDtlTab.delete("task_id = '" + task_id + "'"); + } if (TaskStatusEnum.EXECUTING.getCode().equals(status)) { // 更新任务状态为执行中 @@ -115,12 +115,12 @@ public class InHotTask extends AbstractAcsTask { } } - if(StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { + if (StrUtil.equals(status, TaskStatusEnum.FINISHED.getCode())) { Long currentUserId = SecurityUtils.getCurrentUserId(); String currentUsername = SecurityUtils.getCurrentUsername(); // 更改任务状态为完成 - jsonTask.put("task_status",TaskStatusEnum.FINISHED.getCode()); + jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode()); jsonTask.put("update_optid", currentUserId); jsonTask.put("update_optname", currentUsername); jsonTask.put("update_time", DateUtil.now()); @@ -146,10 +146,10 @@ public class InHotTask extends AbstractAcsTask { // 更新烘箱区库存状态 JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0); jsonHotIvt.put("point_status", "02"); - jsonHotIvt.put("container_name",jsonHotMst.getString("container_name")); - jsonHotIvt.put("workorder_id",jsonHotMst.getString("workorder_id") ); - jsonHotIvt.put("ivt_qty",jsonHotMst.getString("qty") ); - jsonHotIvt.put("instorage_time",DateUtil.now() ); + jsonHotIvt.put("container_name", jsonHotMst.getString("container_name")); + jsonHotIvt.put("workorder_id", jsonHotMst.getString("workorder_id")); + jsonHotIvt.put("ivt_qty", jsonHotMst.getString("qty")); + jsonHotIvt.put("instorage_time", DateUtil.now()); jsonHotIvt.put("update_optid", currentUserId); jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); @@ -191,10 +191,10 @@ public class InHotTask extends AbstractAcsTask { // 更新烘箱区库存状态 JSONObject jsonHotIvt = hotIvtTab.query("point_code = '" + jsonTask.getString("point_code3") + "'").uniqueResult(0); jsonHotIvt.put("point_status", "02"); - jsonHotIvt.put("container_name",container_name ); - jsonHotIvt.put("workorder_id",workorder_id ); - jsonHotIvt.put("ivt_qty",ivt_qty ); - jsonHotIvt.put("instorage_time",DateUtil.now() ); + jsonHotIvt.put("container_name", container_name); + jsonHotIvt.put("workorder_id", workorder_id); + jsonHotIvt.put("ivt_qty", ivt_qty); + jsonHotIvt.put("instorage_time", DateUtil.now()); jsonHotIvt.put("update_optid", currentUserId); jsonHotIvt.put("update_optname", currentUsername); jsonHotIvt.put("update_time", DateUtil.now()); @@ -209,7 +209,7 @@ public class InHotTask extends AbstractAcsTask { String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); param.put("iContainerName", jsonHotMst.getString("container_name")); param.put("iResourceName", hot_point_code); - param.put("iMoveInDate", DateUtil. now()); + param.put("iMoveInDate", DateUtil.now()); param.put("iPlanBakingTemperature", jsonHotDtl.getDoubleValue("temperature")); param.put("iPlanBakingTimer", jsonHotDtl.getDoubleValue("oven_time")); param.put("UserName", userName); @@ -244,17 +244,17 @@ public class InHotTask extends AbstractAcsTask { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); String point_code3 = form.getString("point_code3"); - if (cutConveyorTask.isSingleTask(point_code1)){ - throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); + if (cutConveyorTask.isSingleTask(point_code1)) { + throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!"); } - if (cutConveyorTask.isSingleTask(point_code2)){ - throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); + if (cutConveyorTask.isSingleTask(point_code2)) { + throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!"); } - if (cutConveyorTask.isSingleTask(point_code3)){ - throw new BadRequestException("点位:"+point_code3+"存在未完成的任务!"); + if (cutConveyorTask.isSingleTask(point_code3)) { + throw new BadRequestException("点位:" + point_code3 + "存在未完成的任务!"); } JSONObject json = new JSONObject(); - json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); + json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_type", "010201"); json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode()); @@ -266,25 +266,34 @@ public class InHotTask extends AbstractAcsTask { json.put("create_id", currentUserId); json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); - json.put("priority","1" ); - json.put("acs_task_type","1" ); + json.put("priority", "1"); + json.put("acs_task_type", "1"); tab.insert(json); task_id = json.getString("task_id"); + + //更新对应点位库存为已裹膜 + JSONObject cool_ivt = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + form.getString("point_code1") + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(cool_ivt)) { + throw new BadRequestException("未查询到对应的冷却区点位!"); + } + cool_ivt.put("cool_ivt_status", "02"); + WQLObject.getWQLObject("st_ivt_coolpointivt").update(cool_ivt); + } if (StrUtil.equals(form.getString("type"), "2")) { String point_code1 = form.getString("point_code1"); String point_code2 = form.getString("point_code2"); - if (cutConveyorTask.isSingleTask(point_code1)){ - throw new BadRequestException("点位:"+point_code1+"存在未完成的任务!"); + if (cutConveyorTask.isSingleTask(point_code1)) { + throw new BadRequestException("点位:" + point_code1 + "存在未完成的任务!"); } - if (cutConveyorTask.isSingleTask(point_code2)){ - throw new BadRequestException("点位:"+point_code2+"存在未完成的任务!"); + if (cutConveyorTask.isSingleTask(point_code2)) { + throw new BadRequestException("点位:" + point_code2 + "存在未完成的任务!"); } JSONObject json = new JSONObject(); - json.put("task_id",IdUtil.getSnowflake(1,1).nextId()); + json.put("task_id", IdUtil.getSnowflake(1, 1).nextId()); json.put("task_code", CodeUtil.getNewCode("TASK_CODE")); json.put("task_type", "010203"); json.put("task_status", "01"); @@ -295,8 +304,8 @@ public class InHotTask extends AbstractAcsTask { json.put("create_id", currentUserId); json.put("create_name", currentUsername); json.put("create_time", DateUtil.now()); - json.put("priority","1" ); - json.put("acs_task_type","1" ); + json.put("priority", "1"); + json.put("acs_task_type", "1"); tab.insert(json); task_id = json.getString("task_id"); } @@ -311,7 +320,6 @@ public class InHotTask extends AbstractAcsTask { } - @Override public void cancel(String task_id) {