From 1bade7dfa4b78c0110e51806b7d92ceaa534aece Mon Sep 17 00:00:00 2001 From: liuxy Date: Mon, 31 Oct 2022 18:57:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/nl/start/Init.java | 42 ++++++ .../mps/service/impl/BakingServiceImpl.java | 3 + .../wms/pda/st/rest/VirtualOutController.java | 60 ++++++++ .../wms/pda/st/service/VirtualOutService.java | 40 ++++++ .../impl/ProductionOutServiceImpl.java | 102 ++----------- .../service/impl/VirtualOutServiceImpl.java | 126 ++++++++++++++++ .../nl/wms/pda/st/wql/PDA_PRODUVTIONOUT.wql | 49 +------ .../org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql | 134 ++++++++++++++++++ .../service/impl/StorPublicServiceImpl.java | 2 +- .../service/impl/CheckOutBillServiceImpl.java | 36 +++-- 10 files changed, 445 insertions(+), 149 deletions(-) create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/VirtualOutController.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/VirtualOutService.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java create mode 100644 lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql diff --git a/lms/nladmin-system/src/main/java/org/nl/start/Init.java b/lms/nladmin-system/src/main/java/org/nl/start/Init.java index a6a2cab91..2125fb689 100644 --- a/lms/nladmin-system/src/main/java/org/nl/start/Init.java +++ b/lms/nladmin-system/src/main/java/org/nl/start/Init.java @@ -1,7 +1,12 @@ package org.nl.start; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.modules.common.utils.SecurityUtils; +import org.nl.modules.wql.core.bean.WQLObject; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; @@ -15,6 +20,43 @@ import org.springframework.stereotype.Component; public class Init implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { +// WQLObject tab = WQLObject.getWQLObject("ST_IVT_StructAttr"); + + /*String now = DateUtil.now(); + for (int i = 0; i < 10000; i++) { + + JSONObject json = new JSONObject(); + json.put("struct_id", IdUtil.getSnowflake(1,1).nextId()); + + if (i > 10) { + json.put("struct_code", "01-"+"0"+i+"-01"); + + } else { + json.put("struct_code", "01-"+i+"-01"); + } + json.put("struct_name", "1排"+i+"列"); + json.put("simple_name", "1排"+i+"列"); + json.put("sect_id", "1586913215886004224"); + json.put("sect_code", "XN01"); + json.put("sect_name", "虚拟区"); + json.put("stor_id", "1582991156504039424"); + json.put("stor_code", "CP01"); + json.put("stor_name", "成品仓库"); + json.put("row_num", 1); + json.put("col_num", i); + json.put("layer_num", 1); + json.put("block_num", 1); + json.put("in_order_seq", i); + json.put("out_order_seq", i); + json.put("in_empty_seq", i); + json.put("out_empty_seq", i); + json.put("create_id", "1"); + json.put("create_name", "管理员"); + json.put("create_time", now); + json.put("material_height_type", 1); + tab.insert(json); + }*/ + System.out.println("项目启动成功!"); } 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 e715587eb..4fb6b9900 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 @@ -209,6 +209,7 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("pcsn", ""); jsonCool.put("bill_status", "10"); jsonCool.put("task_id", task_id); + jsonCool.put("qty_unit_id", "1"); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", jsonHotIvt.getString("point_code")); jsonCool.put("create_mode", "03"); @@ -354,6 +355,7 @@ public class BakingServiceImpl implements BakingService { param.put("point_code2", jsonCooIvt.getString("full_point_code")); param.put("container_name", container_name); + InCoolIvtTask inCoolIvtTask = new InCoolIvtTask(); String task_id = inCoolIvtTask.createTask(param); @@ -378,6 +380,7 @@ public class BakingServiceImpl implements BakingService { jsonCool.put("material_id", ""); jsonCool.put("pcsn", ""); jsonCool.put("bill_status", "10"); + jsonCool.put("qty_unit_id", "1"); jsonCool.put("task_id", task_id); jsonCool.put("start_point_code", point_code1); jsonCool.put("end_point_code", jsonCooIvt.getString("full_point_code")); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/VirtualOutController.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/VirtualOutController.java new file mode 100644 index 000000000..e3136e26b --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/rest/VirtualOutController.java @@ -0,0 +1,60 @@ + +package org.nl.wms.pda.st.rest; + + +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.modules.logging.annotation.Log; +import org.nl.wms.pda.st.service.ProductionOutService; +import org.nl.wms.pda.st.service.VirtualOutService; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** +* @author liuxy +* @date 2022-05-25 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "虚拟区发货") +@RequestMapping("/api/pda/virtual") +@Slf4j +public class VirtualOutController { + + private final VirtualOutService virtualOutService; + + @PostMapping("/ivtQuery") + @Log("出库初始化查询") + @ApiOperation("出库初始化查询") + public ResponseEntity ivtQuery(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(virtualOutService.ivtQuery(whereJson),HttpStatus.OK); + } + + @PostMapping("/billType") + @Log("获取单据类型") + @ApiOperation("获取单据类型") + public ResponseEntity billType(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(virtualOutService.billType(whereJson),HttpStatus.OK); + } + + @PostMapping("/ivtDisQuery") + @Log("分配明细查询") + @ApiOperation("分配明细查询") + public ResponseEntity ivtDisQuery(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(virtualOutService.ivtDisQuery(whereJson),HttpStatus.OK); + } + + @PostMapping("/outConfirm") + @Log("出库确认") + @ApiOperation("出库确认") + public ResponseEntity outConfirm(@RequestBody JSONObject whereJson){ + return new ResponseEntity<>(virtualOutService.outConfirm(whereJson),HttpStatus.OK); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/VirtualOutService.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/VirtualOutService.java new file mode 100644 index 000000000..33ca048ba --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/VirtualOutService.java @@ -0,0 +1,40 @@ + +package org.nl.wms.pda.st.service; + +import com.alibaba.fastjson.JSONObject; + +/** +* @description 服务接口 +* @author liuxy +* @date 2022-05-25 +**/ +public interface VirtualOutService { + + /** + * 出库初始化查询 + * @param whereJson / + * @return JSONObject / + */ + JSONObject ivtQuery(JSONObject whereJson); + + /** + * 获取单据类型 + * @param whereJson / + * @return JSONObject / + */ + JSONObject billType(JSONObject whereJson); + + /** + * 分配明细查询 + * @param whereJson / + * @return JSONObject / + */ + JSONObject ivtDisQuery(JSONObject whereJson); + + /** + * 出库确认 + * @param whereJson / + * @return JSONObject / + */ + JSONObject outConfirm(JSONObject whereJson); +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java index 8886f4730..c4440c175 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/ProductionOutServiceImpl.java @@ -32,15 +32,9 @@ public class ProductionOutServiceImpl implements ProductionOutService { @Override public JSONObject ivtQuery(JSONObject whereJson) { - /* option - * 0-生产区查询 - * 1-虚拟区查询 - */ - String option = whereJson.getString("option"); JSONObject map = new JSONObject(); - if (StrUtil.equals(option, "0")) map.put("flag", "1"); - if (StrUtil.equals(option, "1")) map.put("flag", "2"); + map.put("flag", "1"); map.put("box_no", whereJson.getString("box_no")); map.put("point_code", whereJson.getString("point_code")); JSONArray resultJSONArray = WQL.getWO("PDA_PRODUVTIONOUT").addParamMap(map).process().getResultJSONArray(0); @@ -66,94 +60,26 @@ public class ProductionOutServiceImpl implements ProductionOutService { @Override @Transactional(rollbackFor = Exception.class) public JSONObject outConfirm(JSONObject whereJson) { - /* option - * 0-生产区确认 - * 1-虚拟区确认 - */ WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表 - WQLObject ivtTab = WQLObject.getWQLObject("ST_IVT_StructIvt"); // 仓位库存表 - WQLObject subTab = WQLObject.getWQLObject("PDM_BI_SubPackageRelation"); // 子卷包装关系表 - WQLObject ioMstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库单主表 - WQLObject ioDtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库单明细表 - WQLObject ioDidsTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库单分配表 - String option = whereJson.getString("option"); JSONObject box_no = whereJson.getJSONObject("box_no"); - Long deptId = SecurityUtils.getDeptId(); - Long currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - - JSONObject jsonSub = subTab.query("package_box_SN = '" + box_no + "'").uniqueResult(0); - JSONObject jsonPoint = pointTab.query("vehicle_code = '" + box_no + "' and is_delete = '0' and is_used = '1'").uniqueResult(0); - if (StrUtil.equals(option, "0")) { - /* - * 0 - 生产区确认 - * a.解锁出库点位、清除木箱号 - */ - jsonPoint.put("point_status", "00"); - jsonPoint.put("lock_type", "1"); - jsonPoint.put("vehicle_code", ""); - jsonPoint.put("vehicle_type", ""); - jsonPoint.put("vehicle_qty", 0); - pointTab.update(jsonPoint); - } else { - /* - * 1 - 虚拟区确认 - * a.生成出库单主表、明细表、分配表并确认 - * b.更新库存 - * c.更新点位 - */ + /* + * 生产区确认 + * a.解锁出库点位、清除木箱号 + */ + jsonPoint.put("point_status", "00"); + jsonPoint.put("lock_type", "1"); + jsonPoint.put("vehicle_code", ""); + jsonPoint.put("vehicle_type", ""); + jsonPoint.put("vehicle_qty", 0); + pointTab.update(jsonPoint); - JSONObject jsonIvt = ivtTab.query("pcsn = '" + jsonSub.getString("container_name") + "'").uniqueResult(0); + JSONObject jo = new JSONObject(); + jo.put("message", "出库成功!"); - // 生成出库单主表 - JSONObject jsonMst = new JSONObject(); - jsonMst.put("iostorinv_id", IdUtil.getSnowflake(1,1).nextId()); - jsonMst.put("bill_code", CodeUtil.getNewCode("IO_CODE")); - jsonMst.put("io_type", "1"); - jsonMst.put("buss_type", ""); - jsonMst.put("bill_type", ""); - jsonMst.put("biz_date", DateUtil.today()); - jsonMst.put("detail_count", 1); - jsonMst.put("bill_status", "99"); - jsonMst.put("create_mode", "02"); - jsonMst.put("input_optid", currentUserId); - jsonMst.put("input_optname", nickName); - jsonMst.put("input_time", now); - jsonMst.put("update_optid", currentUserId); - jsonMst.put("update_optname", nickName); - jsonMst.put("update_time", now); - jsonMst.put("dis_optid", currentUserId); - jsonMst.put("dis_optname", nickName); - jsonMst.put("dis_time", now); - jsonMst.put("confirm_optid", currentUserId); - jsonMst.put("confirm_optname", nickName); - jsonMst.put("confirm_time", now); - jsonMst.put("sysdeptid", deptId); - jsonMst.put("syscompanyid", deptId); - ioMstTab.insert(jsonMst); - - // 生成出库单明细表 - JSONObject jsonDtl = new JSONObject(); - jsonDtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1,1).nextId()); - jsonDtl.put("iostorinv_id", jsonMst.getString("iostorinv_id")); - jsonDtl.put("seq_no", 1); -// jsonDtl.put("material_id", ""); - jsonDtl.put("pcsn", jsonSub.getString("container_name")); - jsonDtl.put("box_no", box_no); - jsonDtl.put("bill_status", "99"); - jsonDtl.put("qty_unit_id", 1); - jsonDtl.put("qty_unit_name", "KG"); - jsonDtl.put("plan_qty", jsonIvt.getDoubleValue("ivt_qty")); - jsonDtl.put("real_qty", jsonIvt.getDoubleValue("ivt_qty")); - - } - - - return null; + return jo; } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java new file mode 100644 index 000000000..a44b87759 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/VirtualOutServiceImpl.java @@ -0,0 +1,126 @@ + +package org.nl.wms.pda.st.service.impl; + + +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.wql.WQL; +import org.nl.modules.wql.core.bean.WQLObject; +import org.nl.wms.pda.st.service.VirtualOutService; +import org.nl.wms.st.inbill.service.CheckOutBillService; +import org.nl.wms.st.outbill.service.impl.CheckOutBillServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * @author liuxy + * @description 服务实现 + * @date 2022-05-25 + **/ +@Service +@RequiredArgsConstructor +@Slf4j +public class VirtualOutServiceImpl implements VirtualOutService { + + private final CheckOutBillService checkOutBillService; + + @Override + public JSONObject ivtQuery(JSONObject whereJson) { + + JSONObject map = new JSONObject(); + map.put("flag", "1"); + map.put("box_no", whereJson.getString("box_no")); + map.put("bill_code", whereJson.getString("bill_code")); + map.put("bill_type", whereJson.getString("bill_type")); + JSONArray resultJSONArray = WQL.getWO("PDA_VIRTUALOUT").addParamMap(map).process().getResultJSONArray(0); + + JSONObject jo = new JSONObject(); + jo.put("data", resultJSONArray); + jo.put("message", "查询成功!"); + return jo; + } + + @Override + public JSONObject billType(JSONObject whereJson) { + JSONArray resultJSONArray = WQLObject.getWQLObject("sys_dict_detail").query("name = 'ST_INV_OUT_TYPE'").getResultJSONArray(0); + + JSONObject jo = new JSONObject(); + jo.put("rows", resultJSONArray); + jo.put("message", "查询成功!"); + return jo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public JSONObject ivtDisQuery(JSONObject whereJson) { + + JSONObject map = new JSONObject(); + map.put("flag", "2"); + map.put("box_no", whereJson.getString("box_no")); + map.put("bill_code", whereJson.getString("bill_code")); + map.put("material_code", whereJson.getString("material_code")); + + JSONArray resultJSONArray = WQL.getWO("PDA_VIRTUALOUT").addParamMap(map).process().getResultJSONArray(0); + + for (int i = 0; i < resultJSONArray.size(); i++) { + JSONObject jsonObject = resultJSONArray.getJSONObject(i); + String isRePrintPackageBoxLabel = jsonObject.getString("isRePrintPackageBoxLabel"); + String isUnPackBox = jsonObject.getString("isUnPackBox"); + + if (StrUtil.equals(isRePrintPackageBoxLabel, "1") || StrUtil.equals(isUnPackBox, "1")) { + jsonObject.put("colro_flag", "1"); + } else { + jsonObject.put("colro_flag", "0"); + } + } + + JSONObject jo = new JSONObject(); + jo.put("data", resultJSONArray); + jo.put("message", "查询成功!"); + return jo; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public JSONObject outConfirm(JSONObject whereJson) { + + WQLObject disTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); // 出入库分配明细表 + WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表 + + String box_no = whereJson.getString("box_no"); // 箱号 + + JSONArray disArr = disTab.query("box_no = '" + box_no + "' and work_status <> '99'").getResultJSONArray(0); + for (int i = 0; i < disArr.size(); i++) { + JSONObject jsonDis = disArr.getJSONObject(i); + // 更新状态为完成 + jsonDis.put("work_status", "99"); + disTab.update(jsonDis); + + // 判断分配明细是否全部完成 + JSONArray disNoArr = disTab.query("iostorinvdtl_id = '" + jsonDis.getString("iostorinvdtl_id") + "' and work_status <> '99'").getResultJSONArray(0); + if (ObjectUtil.isEmpty(disNoArr)) { + // 更新明细表状态为完成 + JSONObject jsonDtl = dtlTab.query("iostorinvdtl_id = '" + jsonDis.getString("iostorinvdtl_id") + "'").uniqueResult(0); + jsonDtl.put("bill_status", "99"); + dtlTab.update(jsonDtl); + + // 判断此明细是否全部完成 + JSONArray dtlNoArr = dtlTab.query("iostorinv_id = '" + jsonDis.getString("iostorinv_id") + "' and bill_status <> '99'").getResultJSONArray(0); + if (ObjectUtil.isEmpty(dtlNoArr)) { + // 调用强制完成接口 + JSONObject param = new JSONObject(); + param.put("iostorinv_id",jsonDis.getString("iostorinv_id")); + checkOutBillService.confirm(param); + } + } + } + JSONObject jo = new JSONObject(); + jo.put("message", "出库成功!"); + return jo; + } + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_PRODUVTIONOUT.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_PRODUVTIONOUT.wql index 3490ae602..77e4d08d1 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_PRODUVTIONOUT.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_PRODUVTIONOUT.wql @@ -1,5 +1,5 @@ [交易说明] - 交易名: 成品出库 + 交易名: 发货区出库 所属模块: 功能简述: 版权所有: @@ -82,49 +82,4 @@ ENDSELECT ENDQUERY - ENDIF - - IF 输入.flag = "2" - QUERY - SELECT - sub.package_box_SN AS package_box_SN, - sub.container_name AS container_name, - sub.product_name AS product_name, - sub.product_description AS product_description, - sub.net_weight AS net_weight, - ( - CASE - sub.isRePrintPackageBoxLabel - WHEN '1' THEN '是' - WHEN '0' THEN '否' - END - ) AS change_out, - ( - CASE - sub.isUnPackBox - WHEN '1' THEN '是' - WHEN '0' THEN '否' - END - ) AS change_in, - - sub.isRePrintPackageBoxLabel, - sub.isUnPackBox, - attr.struct_code AS point_code - FROM - PDM_BI_SubPackageRelation sub - LEFT JOIN ST_IVT_StructIvt ivt ON sub.container_name = ivt.pcsn - LEFT JOIN ST_IVT_StructAttr attr ON attr.struct_id = ivt.struct_id - WHERE - 1=1 - - OPTION 输入.box_no <> "" - attr.storagevehicle_code = 输入.box_no - ENDOPTION - - OPTION 输入.point_code <> "" - attr.struct_code = 输入.point_code - ENDOPTION - - ENDSELECT - ENDQUERY - ENDIF + ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql new file mode 100644 index 000000000..19421ac6e --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/wql/PDA_VIRTUALOUT.wql @@ -0,0 +1,134 @@ +[交易说明] + 交易名: 虚拟区出库 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.bill_code TYPEAS s_string + 输入.bill_type TYPEAS s_string + 输入.material_code TYPEAS s_string + + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + + IF 输入.flag = "1" + QUERY + SELECT + mst.iostorinv_id, + mst.bill_code, + ( + CASE + mst.bill_type + WHEN '1001' THEN '发货出库' + WHEN '1002' THEN '报废出库' + WHEN '1003' THEN '改切出库' + WHEN '1009' THEN '手工出库' + END + ) AS bill_type_name, + mst.source_id AS source_bill_code, + mst.biz_date, + mst.input_optname AS person_name + FROM + ST_IVT_IOStorInv mst + LEFT JOIN ST_IVT_IOStorInvDis dis ON dis.iostorinv_id = mst.iostorinv_id + WHERE + dis.sect_id = '1586913215886004224' + AND mst.is_delete = '0' + AND mst.bill_status <> '99' + + OPTION 输入.box_no <> "" + dis.box_no = 输入.box_no + ENDOPTION + + OPTION 输入.bill_code <> "" + mst.bill_code = 输入.bill_code + ENDOPTION + + OPTION 输入.bill_type <> "" + mst.bill_type = 输入.bill_type + ENDOPTION + + ENDSELECT + ENDQUERY + ENDIF + + IF 输入.flag = "2" + QUERY + SELECT + dis.box_no AS package_box_SN, + dis.pcsn AS container_name, + mater.material_code AS product_name, + mater.material_name AS product_description, + sub.net_weight, + sub.isRePrintPackageBoxLabel, + sub.isUnPackBox, + ( + CASE + sub.isRePrintPackageBoxLabel + WHEN '0' THEN '否' + WHEN '1' THEN '是' + END + ) AS change_out, + ( + CASE + sub.isUnPackBox + WHEN '0' THEN '否' + WHEN '1' THEN '是' + END + ) AS change_in, + dis.iostorinvdis_id + FROM + ST_IVT_IOStorInvDis dis + LEFT JOIN ST_IVT_IOStorInv mst ON dis.iostorinv_id = mst.iostorinv_id + LEFT JOIN md_me_materialbase mater ON dis.material_id = mater.material_id + LEFT JOIN PDM_BI_SubPackageRelation sub ON dis.pcsn = sub.container_name + WHERE + dis.sect_id = '1586913215886004224' + AND mst.is_delete = '0' + AND dis.work_status <> '99' + + OPTION 输入.box_no <> "" + dis.box_no = 输入.box_no + ENDOPTION + + OPTION 输入.bill_code <> "" + mst.bill_code = 输入.bill_code + ENDOPTION + + OPTION 输入.material_code <> "" + mater.material_code = 输入.material_code + ENDOPTION + + ENDSELECT + ENDQUERY + ENDIF \ No newline at end of file diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/StorPublicServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/StorPublicServiceImpl.java index 2f560f767..92a58f256 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/StorPublicServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/StorPublicServiceImpl.java @@ -452,7 +452,7 @@ public class StorPublicServiceImpl implements StorPublicService { throw new BadRequestException("点位仓位更新未查询到符合条件的点位仓位!"); } HashMap map = new HashMap<>(); - if(lock_type.equals("00")){//解锁 + if(lock_type.equals("1")){//解锁 map.put("lock_type",lock_type); map.put("task_code",""); map.put("inv_type",""); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java index b35855994..a647dd9ef 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/service/impl/CheckOutBillServiceImpl.java @@ -393,13 +393,18 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("struct_code", ivt.getString("struct_code")); dtl.put("struct_name", ivt.getString("struct_name")); dtl.put("pcsn", ivt.getString("pcsn")); - dtl.put("work_status", "00"); dtl.put("storagevehicle_id", ivt.getString("storagevehicle_id")); dtl.put("storagevehicle_code", ivt.getString("storagevehicle_code")); dtl.put("storagevehicle_type", ivt.getString("storagevehicle_type")); dtl.put("is_issued", "0"); dtl.put("plan_qty", ivt.getDoubleValue("change_qty")); dtl.put("real_qty", ivt.getDoubleValue("change_qty")); + // 如果所属仓位是虚拟区 则将分配明细状态变为生成 + if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) { + dtl.put("work_status", "01"); + } else { + dtl.put("work_status", "00"); + } wo_dis.insert(dtl); //记录需锁定的仓位 Struct_map.put(ivt.getString("struct_id"), ivt); @@ -423,7 +428,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { Collection c = Struct_map.values(); Iterator it = c.iterator(); JSONObject from_start = new JSONObject(); - from_start.put("lock_type", "01"); + from_start.put("lock_type", "2"); for (; it.hasNext(); ) { JSONObject Struct = it.next(); from_start.put("struct_id", Struct.getString("struct_id")); @@ -528,13 +533,13 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { //解锁起点仓位点位 JSONObject from_start = new JSONObject(); from_start.put("struct_id", dis.getString("struct_id")); - from_start.put("lock_type", "00"); + from_start.put("lock_type", "1"); storPublicService.updateStructAndPoint(from_start); //解锁终点仓位点位 if (StrUtil.isNotEmpty(dis.getString("point_code"))) { JSONObject from_end = new JSONObject(); from_end.put("point_code", dis.getString("point_code")); - from_end.put("lock_type", "00"); + from_end.put("lock_type", "1"); storPublicService.updateStructAndPoint(from_end); } } else {//仓位载具扔有冻结数,需改任务类型为拣选出库 @@ -572,11 +577,11 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { if (ObjectUtil.isEmpty(jo_mst)) { throw new BadRequestException("未查到相关出库单"); } - JSONObject point = wo_Point.query("lock_type='00' and (vehicle_code='' or vehicle_code IS NULL) and point_code='" + point_code + "'").uniqueResult(0); + JSONObject point = wo_Point.query("lock_type='1' and (vehicle_code='' or vehicle_code IS NULL) and point_code='" + point_code + "'").uniqueResult(0); //如果终点站点被锁定或者有载具号,则不允许设置点位 - /* if (ObjectUtil.isEmpty(point)) { + if (ObjectUtil.isEmpty(point)) { throw new BadRequestException("该站点被锁定或者有载具号,不允许设置!"); - }*/ + } //查询未生成和生成未下发的分配记录 JSONArray diss = WQL.getWO("QST_IVT_CHECKOUTBILL") .addParam("flag", "5") @@ -613,7 +618,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { //解锁原终点 JSONObject from_end = new JSONObject(); from_end.put("point_code", dis.getString("point_code")); - from_end.put("lock_type", "00"); + from_end.put("lock_type", "1"); storPublicService.updateStructAndPoint(from_end); } else {//生成任务 task = new JSONObject(); @@ -747,13 +752,18 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { dtl.put("struct_code", ivt.getString("struct_code")); dtl.put("struct_name", ivt.getString("struct_name")); dtl.put("pcsn", ivt.getString("pcsn")); - dtl.put("work_status", "00"); dtl.put("storagevehicle_id", ivt.getString("storagevehicle_id")); dtl.put("storagevehicle_code", ivt.getString("storagevehicle_code")); dtl.put("storagevehicle_type", ivt.getString("storagevehicle_type")); dtl.put("is_issued", "0"); dtl.put("plan_qty", ivt.getDoubleValue("change_qty")); dtl.put("real_qty", ivt.getDoubleValue("change_qty")); + // 如果所属仓位是虚拟区 则将分配明细状态变为生成 + if (StrUtil.equals(ivt.getString("sect_code"), "XN01")) { + dtl.put("work_status", "01"); + } else { + dtl.put("work_status", "00"); + } wo_dis.insert(dtl); //记录需锁定的仓位 Struct_map.put(ivt.getString("struct_id"), ivt); @@ -789,7 +799,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { //锁定起点仓位点位 JSONObject from_start = new JSONObject(); from_start.put("struct_id", Struct.getString("struct_id")); - from_start.put("lock_type", "01"); + from_start.put("lock_type", "2"); from_start.put("inv_type", jo_mst.getString("bill_type")); from_start.put("inv_id", jo_mst.getString("iostorinv_id")); from_start.put("inv_code", jo_mst.getString("bill_code")); @@ -888,7 +898,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { //解锁起点 JSONObject from_start = new JSONObject(); from_start.put("struct_id", dis.getString("struct_id")); - from_start.put("lock_type", "00"); + from_start.put("lock_type", "1"); if ("02".equals(dis.getString("taskdtl_type"))) { from_start.put("is_free", "1"); } @@ -996,9 +1006,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { wo_dis.update(map, "task_id='" + task_id + "'"); // 更新明细为完成 - /* JSONObject jsonDtl = wo_dtl.query("iostorinvdtl_id = '" + whereJson.getString("iostorinvdtl_id") + "'").uniqueResult(0); + JSONObject jsonDtl = wo_dtl.query("iostorinvdtl_id = '" + whereJson.getString("iostorinvdtl_id") + "'").uniqueResult(0); jsonDtl.put("bill_status", "99"); - wo_dtl.update(jsonDtl);*/ + wo_dtl.update(jsonDtl); //判断是否还有未完成的明细 JSONArray ja = wo_dtl.query("bill_status<>'99' and iostorinv_id='" + whereJson.getString("iostorinv_id") + "'").getResultJSONArray(0);