diff --git a/lms/nladmin-system/src/main/java/org/nl/modules/common/exception/InterfaceException.java b/lms/nladmin-system/src/main/java/org/nl/modules/common/exception/InterfaceException.java new file mode 100644 index 000000000..d5e771177 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/modules/common/exception/InterfaceException.java @@ -0,0 +1,41 @@ +/* + * Copyright 2019-2020 Zheng Jie + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.nl.modules.common.exception; + +import lombok.Getter; +import org.springframework.http.HttpStatus; + +import static org.springframework.http.HttpStatus.BAD_REQUEST; + +/** + * @author Zheng Jie + * @date 2018-11-23 + * 统一异常处理 + */ +@Getter +public class BadRequestException extends RuntimeException{ + + private Integer status = BAD_REQUEST.value(); + + public BadRequestException(String msg){ + super(msg); + } + + public BadRequestException(HttpStatus status,String msg){ + super(msg); + this.status = status.value(); + } +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls index c5bd82cce..e1e2d8fae 100644 Binary files a/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls and b/lms/nladmin-system/src/main/java/org/nl/wms/basedata/st/wql/stivt.xls differ diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java index 9aae10810..270a7c92d 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/mes/service/impl/MesToLmsServiceImpl.java @@ -275,7 +275,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { if (ObjectUtil.isEmpty(bakingTimer)) throw new BadRequestException("烘烤时间不能为空"); String point_code = ""; - JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' and cool_ivt_status <> '03'").uniqueResult(0); + JSONObject jsonCoolIvt = coolIvtTab.query("container_name = '" + containerName + "' and full_point_status = '02' and cool_ivt_status <> '04'").uniqueResult(0); if (ObjectUtil.isEmpty(jsonCoolIvt)) { JSONObject jsonPoint = pointTab.query("material_code ='" + containerName + "'").uniqueResult(0); if (ObjectUtil.isNotEmpty(jsonPoint)) point_code = jsonPoint.getString("point_code"); @@ -740,24 +740,21 @@ public class MesToLmsServiceImpl implements MesToLmsService { try { // String is_mesTolms = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("is_mesTolms").getValue(); // if (StrUtil.equals(is_mesTolms, "1")) { - String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 生产订单 + String isUnPlanProductionBox = param.getString("isUnPlanProductionBox"); // 是否计划外子卷 String QuanlityInBox = param.getString("QuanlityInBox"); // 产品编码 String QualityGuaranPeriod = param.getString("QualityGuaranPeriod"); // 保质期 String ProductName = param.getString("ProductName"); // 来源卷位置 String Description = param.getString("Description"); // 来源卷位置 String DateOfFGInbound = param.getString("DateOfFGInbound"); // 来源卷位置 + String BoxWeight = param.getString("BoxWeight"); // 来源卷位置 String box_type = param.getString("Attribute1"); // 木箱料号 String box_length = param.getString("Attribute2"); // 木箱料号 String box_width = param.getString("Attribute3"); // 木箱料号 String box_high = param.getString("Attribute4"); // 木箱料号 - - double BoxWeight = 0; // 木箱自身重量 - JSONArray details = param.getJSONArray("details"); if (ObjectUtil.isEmpty(details)) throw new BadRequestException("明细为空"); for (int i = 0; i < details.size(); i++) { JSONObject detail = details.getJSONObject(i); - BoxWeight = NumberUtil.add(BoxWeight, detail.getDoubleValue("NetWeight")); String PackageBoxSN = detail.getString("PackageBoxSN"); // 分切订单类型 String ContainerName = detail.getString("ContainerName"); // 子卷号 @@ -787,7 +784,7 @@ public class MesToLmsServiceImpl implements MesToLmsService { jo.put("box_width", box_width); jo.put("box_high", box_high); jo.put("quanlity_in_box", QuanlityInBox); -// jo.put("box_weight", BoxWeight); + jo.put("box_weight", BoxWeight); if (QualityGuaranPeriod.equals("0天")){ jo.put("quality_guaran_period", "90天"); }else { diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java index 8061fbcd0..2f12780fe 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/ext/sap/service/impl/SapToLmsServiceImpl.java @@ -39,6 +39,8 @@ public class SapToLmsServiceImpl implements SapToLmsService { for (int i = 0; i < rows.size(); i++) { JSONObject row = rows.getJSONObject(i); String MATNR = row.getString("MATNR"); + String MATNR01 = row.getString("MATNR01"); + String MEINS = row.getString("MEINS"); if (StrUtil.isEmpty(MATNR)) { throw new BadRequestException("物料编码不能为空!"); } @@ -48,6 +50,39 @@ public class SapToLmsServiceImpl implements SapToLmsService { } else { WQLObject.getWQLObject("md_me_materialbaseext").update(row); } + + JSONObject base_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '"+MATNR+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(base_jo)){ + JSONObject mater_base_jo = new JSONObject(); + mater_base_jo.put("material_id",IdUtil.getSnowflake(1,1).nextId()); + mater_base_jo.put("material_code",MATNR); + mater_base_jo.put("material_name",MATNR01); + JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '"+MEINS+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(unit)){ + throw new BadRequestException("未查询到相关计量单位,请进行维护!"); + } + mater_base_jo.put("base_unit_id",unit.getString("measure_unit_id")); + mater_base_jo.put("create_id", "1"); + mater_base_jo.put("create_name", "管理员"); + mater_base_jo.put("create_time", DateUtil.now()); + mater_base_jo.put("update_optid", "1"); + mater_base_jo.put("update_optname", "管理员"); + mater_base_jo.put("update_time", DateUtil.now()); + mater_base_jo.put("is_used","1"); + mater_base_jo.put("is_delete","0"); + WQLObject.getWQLObject("md_me_materialbase").insert(mater_base_jo); + }else { + base_jo.put("material_name",MATNR01); + JSONObject unit = WQLObject.getWQLObject("md_pb_measureunit").query("unit_code = '"+MEINS+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(unit)){ + throw new BadRequestException("未查询到相关计量单位,请进行维护!"); + } + base_jo.put("base_unit_id",unit.getString("measure_unit_id")); + base_jo.put("update_optid", "1"); + base_jo.put("update_optname", "管理员"); + base_jo.put("update_time", DateUtil.now()); + WQLObject.getWQLObject("md_me_materialbase").update(base_jo); + } } } catch (Exception exception) { result.put("RTYPE", "E"); 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 new file mode 100644 index 000000000..95b68136c --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/HandleBakingController.java @@ -0,0 +1,40 @@ +package org.nl.wms.pda.mps.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.mps.service.BakingService; +import org.nl.wms.pda.mps.service.RawFoilService; +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; + +@RestController +@RequiredArgsConstructor +@Api(tags = "烘烤工序") +@RequestMapping("api/pda/baking") +@Slf4j +public class BakingController { + + private final BakingService bakingService; + + @PostMapping("/ovenInAndOut") + @Log("烘箱出入") + @ApiOperation("烘箱出入") + public ResponseEntity queryRawFoil(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(bakingService.ovenInAndOut(whereJson),HttpStatus.OK); + } + + @PostMapping("/inCoolIvt") + @Log("入冷却") + @ApiOperation("入冷却") + public ResponseEntity inCoolIvt(@RequestBody JSONObject whereJson) { + return new ResponseEntity<>(bakingService.inCoolIvt(whereJson),HttpStatus.OK); + } +} 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 new file mode 100644 index 000000000..ef53194c7 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/HandleBakingService.java @@ -0,0 +1,22 @@ +package org.nl.wms.pda.mps.service; + +import com.alibaba.fastjson.JSONObject; + +public interface BakingService { + + /** + * 烘箱出入 + * @param whereJson / + * @return JSONObject + */ + JSONObject ovenInAndOut(JSONObject whereJson); + + /** + * 入冷却 + * @param whereJson / + * @return JSONObject + */ + JSONObject inCoolIvt(JSONObject whereJson); + + +} 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 new file mode 100644 index 000000000..f7b972b53 --- /dev/null +++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/HandleBakingServiceImpl.java @@ -0,0 +1,463 @@ +package org.nl.wms.pda.mps.service.impl; + +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.IdUtil; +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.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.sch.tasks.InCoolIvtTask; +import org.nl.wms.sch.tasks.InHotTask; +import org.nl.wms.sch.tasks.OutHotTask; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Slf4j +public class BakingServiceImpl implements BakingService { + + /* + * 业务流程: + * 入烤箱: + * 1.首先需要找到无任务的暂存位 并创建两条任务 + * 2。下发冷却区 --> 烘烤区的任务 等待反馈完成 + * 3.插入烤箱区出入主表和明细表 + * 出烤箱: + * 1.烤箱时间到后 查找无任务的暂存位 并创建2条任务 + * 2.1下发烤箱区 --> 暂存位 的任务 + * 2.2插入烤箱区出入明细表 + * 3.查找对应冷却区空位 + * 4.在下发暂存位 --> 冷却区的任务 + * 问题: + * 1.第二条任务出现异常后 如何再次触发 + */ + @Override + @Transactional + public JSONObject ovenInAndOut(JSONObject whereJson) { + + String option = whereJson.getString("option"); // 1-入箱 2-出箱 + + WQLObject pointTab = WQLObject.getWQLObject("SCH_BASE_Point"); // 点位表 + WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表 + WQLObject coolIvtTab = WQLObject.getWQLObject("ST_IVT_CoolPointIvt"); // 冷却区点位库存表 + WQLObject hosIvtTab = WQLObject.getWQLObject("ST_IVT_HotPointIvt"); // 烤箱区点位库存表 + WQLObject hosReMstTab = 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"); // 物料表 + + + 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("点位不能为空"); + + /* + * 根据点位判断是 冷却区入烘箱还是暂存区入烘箱 + */ + 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")); + + InHotTask inHotTask = new InHotTask(); + String task_id = inHotTask.createTask(param); + + // 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); + + + // 生成冷却区出入表 + 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("start_point_code", point_code1); + hotParam.put("next_point_code", point_code2); + hotParam.put("temperature", jsonHotIvt.getString("temperature")); + this.createHotDtl(hotParam); + } + JSONObject result = new JSONObject(); + result.put("message", "操作成功!"); + return result; + } + + @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"); // 物料表 + + + 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 (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); + + + 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); + + JSONObject result = new JSONObject(); + result.put("message", "操作成功!"); + return result; + } + + @Transactional + public String createHotIoMst(JSONObject param) { + /* + * 创建烘箱区出入主表 + */ + WQLObject hotMstTab = WQLObject.getWQLObject("ST_IVT_HotRegionIOMst"); // 烘箱区出入主表 + + JSONObject jsonHotMst = new JSONObject(); + jsonHotMst.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId()); + jsonHotMst.put("bill_code", CodeUtil.getNewCode("HOT_BILL_CODE")); + jsonHotMst.put("container_name", param.getString("container_name")); + 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", "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"); + } + + @Transactional + public void createHotDtl(JSONObject param) { + /* + * 创建烘箱区出入明细表 + */ + WQLObject hotDtlTab = WQLObject.getWQLObject("ST_IVT_HotRegionIODtl"); // 烘箱区出入明细表 + + JSONObject jsonHotDtl = new JSONObject(); + 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")); + jsonHotDtl.put("oven_time", param.getString("oven_time")); + jsonHotDtl.put("task_type", "1"); + jsonHotDtl.put("task_id", param.getString("task_id")); + jsonHotDtl.put("create_id", 2); + jsonHotDtl.put("create_name", "mes用户"); + jsonHotDtl.put("create_time", DateUtil.now()); + jsonHotDtl.put("dtl_status", "10"); + hotDtlTab.insert(jsonHotDtl); + } + + +} diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java index 5e660012a..f65651984 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/service/impl/RawAssistIStorServiceImpl.java @@ -448,7 +448,7 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService { HashMap map = rows.get(0); //判断该载具是否已经分配货位或者起点 - JSONArray now_dis_rows = WQLObject.getWQLObject("st_ivt_iostorinvdis").query("box_no = '" + map.get("box_no") + "' AND work_status < '99' AND (struct_id <> '' AND struct_id is not null)").getResultJSONArray(0); + JSONArray now_dis_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("flag","17").addParam("box_no",map.get("box_no")).process().getResultJSONArray(0); if (now_dis_rows.size() > 0) { throw new BadRequestException("该木箱已经分配过货位,无法继续分配!"); } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql index 49633ecf6..8365d9484 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/inbill/wql/QST_IVT_RAWASSISTISTOR.wql @@ -22,6 +22,7 @@ 输入.stor_id TYPEAS s_string 输入.bill_status TYPEAS s_string 输入.bill_type TYPEAS s_string + 输入.box_no TYPEAS s_string 输入.container_name TYPEAS s_string 输入.package_box_sn TYPEAS s_string 输入.iostorinv_id TYPEAS s_string @@ -633,6 +634,23 @@ ENDQUERY ENDIF + IF 输入.flag = "17" + QUERY + SELECT + * + FROM + st_ivt_iostorinvdis dis + LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id + WHERE + dis.box_no = 输入.box_no + AND work_status < '99' + AND ( struct_id <> '' AND struct_id IS NOT NULL ) + AND mst.is_delete = '0' + AND mst.bill_status < '99' + ENDSELECT + ENDQUERY + ENDIF + 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 912056d35..33df6b742 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 @@ -79,6 +79,9 @@ public class CheckOutBillServiceImpl implements CheckOutBillService { if (StrUtil.isNotEmpty(map.get("material_code"))) { map.put("material_code", "%" + map.get("material_code") + "%"); } + if (StrUtil.isNotEmpty(map.get("vbeln"))) { + map.put("vbeln", "%" + map.get("vbeln") + "%"); + } //获取人员对应的仓库 UserStorServiceImpl userStorService = new UserStorServiceImpl(); diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql index bcf93e5fc..821e65fd5 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/outbill/wql/QST_IVT_CHECKOUTBILL.wql @@ -20,6 +20,7 @@ 输入.username TYPEAS s_string 输入.create_mode TYPEAS s_string 输入.bill_type TYPEAS s_string + 输入.vbeln TYPEAS s_string 输入.stor_id TYPEAS s_string 输入.iostorinv_id TYPEAS s_string 输入.buss_type TYPEAS s_string @@ -71,14 +72,16 @@ IF 输入.flag = "1" PAGEQUERY - SELECT + SELECT DISTINCT ios.*, cu.shd_dtl_num, cu.cust_name, + dtl.vbeln, cu.cust_simple_name FROM ST_IVT_IOStorInv ios LEFT JOIN md_cs_customerbase cu ON ios.cust_code = cu.cust_code + LEFT JOIN st_ivt_iostorinvdtl dtl ON ios.iostorinv_id = dtl.iostorinv_id WHERE ios.io_type = '1' and ios.is_delete='0' @@ -92,6 +95,10 @@ ios.io_type = 输入.io_type ENDOPTION + OPTION 输入.vbeln <> "" + dtl.vbeln like 输入.vbeln + ENDOPTION + OPTION 输入.bill_type <> "" ios.bill_type = 输入.bill_type ENDOPTION @@ -574,7 +581,7 @@ st_ivt_iostorinvdis dis LEFT JOIN md_me_materialbase mater ON dis.material_id = mater.material_id LEFT JOIN sch_base_point point ON dis.point_id = point.point_id - INNER JOIN sch_base_task task ON dis.task_id = task.task_id + LEFT JOIN sch_base_task task ON dis.task_id = task.task_id WHERE 1=1 diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java index 1e363eab7..e9144ea41 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/service/impl/InAndOutRetrunServiceImpl.java @@ -8,6 +8,7 @@ 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.common.utils.SecurityUtils; import org.nl.modules.common.utils.dto.CurrentUser; import org.nl.modules.system.service.impl.ParamServiceImpl; @@ -19,9 +20,13 @@ import org.nl.wms.basedata.st.service.impl.UserStorServiceImpl; import org.nl.wms.ext.mes.service.impl.LmsToMesServiceImpl; import org.nl.wms.ext.sap.service.impl.LmsToSapServiceImpl; import org.nl.wms.st.returns.service.InAndOutReturnService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; +import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionCallbackWithoutResult; +import org.springframework.transaction.support.TransactionTemplate; import java.util.ArrayList; import java.util.HashMap; @@ -34,6 +39,7 @@ import java.util.Map; @RequiredArgsConstructor @Slf4j public class InAndOutRetrunServiceImpl implements InAndOutReturnService { + private final TransactionTemplate transactionTemplate; @Override public Map pageQuery(Map whereJson, Pageable page) { @@ -50,6 +56,8 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { map.put("begin_time", MapUtil.getStr(whereJson, "begin_time")); map.put("end_time", MapUtil.getStr(whereJson, "end_time")); map.put("pcsn", MapUtil.getStr(whereJson, "pcsn")); + map.put("is_writeoff", MapUtil.getStr(whereJson, "is_writeoff")); + map.put("vbeln", MapUtil.getStr(whereJson, "vbeln")); if (!ObjectUtil.isEmpty(bill_code)) map.put("bill_code", "%" + bill_code + "%"); if (!ObjectUtil.isEmpty(material_search)) map.put("material_search", "%" + material_search + "%"); if (!ObjectUtil.isEmpty(box_no)) map.put("box_no", "%" + box_no + "%"); @@ -92,7 +100,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { String stor_id = jo_mst.getString("stor_id"); JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0); String lgort = stor_jo.getString("ext_id"); - String is_virtualstore = stor_jo.getString("is_virtualstore"); String is_productstore = stor_jo.getString("is_productstore"); //生产入库 if (StrUtil.equals(bill_type, "0001")) { @@ -107,6 +114,11 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { paramMesMst.put("PackageBoxSN", box_row.getString("box_no")); paramMesMst.put("User", box_row.getString("confirm_optname")); new LmsToMesServiceImpl().childRollFGInboundComplete(paramMesMst); + + jo_mst.put("is_upload", "1"); + jo_mst.put("upload_mes", "1"); + jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId()); + jo_mst.put("upload_time", DateUtil.now()); } } @@ -139,6 +151,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst); + + jo_mst.put("upload_mes", "1"); + if (jo_mst.getString("upload_sap").equals("1")) { + jo_mst.put("is_upload", "1"); + } + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } // 调拨出库 @@ -170,6 +188,10 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst); + + jo_mst.put("upload_mes", "1"); + jo_mst.put("is_upload", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } // 改切出库 @@ -186,6 +208,11 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { mes_jo.put("package_box_sn", source_dtl.getString("box_no")); mes_jo.put("warehouse", "3"); new LmsToMesServiceImpl().cutPlanMomRollDeliveryComplete(mes_jo); + + jo_mst.put("upload_mes", "1"); + if (jo_mst.getString("upload_sap").equals("1")) { + jo_mst.put("is_upload", "1"); + } } } } @@ -215,7 +242,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { String stor_id = jo_mst.getString("stor_id"); JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0); String lgort = stor_jo.getString("ext_id"); - String is_virtualstore = stor_jo.getString("is_virtualstore"); String is_productstore = stor_jo.getString("is_productstore"); //退货入库 if (StrUtil.equals(bill_type, "0002")) { @@ -276,6 +302,10 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToSapServiceImpl().returnDelivery(param); + + jo_mst.put("upload_sap", "1"); + jo_mst.put("is_upload", "1"); + } // 销售出库 @@ -339,6 +369,11 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToSapServiceImpl().returnDelivery(param); + + jo_mst.put("upload_sap", "1"); + if (jo_mst.getString("upload_mes").equals("1") || is_productstore.equals("0")) { + jo_mst.put("is_upload", "1"); + } } // 改切出库 @@ -394,26 +429,18 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 System.out.println(paramMst.toString()); new LmsToSapServiceImpl().returnMoveDtl(paramMst); + + jo_mst.put("upload_sap", "1"); + if (jo_mst.getString("upload_mes").equals("1")) { + jo_mst.put("is_upload", "1"); + } } } } } - @Transactional(rollbackFor = Exception.class) @Override public void disupload(JSONObject whereJson) { - //出库分配表 - WQLObject wo_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis"); - //出库明细表 - WQLObject wo_dtl = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); - //出库主表 - WQLObject wo_mst = WQLObject.getWQLObject("ST_IVT_IOStorInv"); - // 物料表 - WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); - // 库区表 - WQLObject sectTab = WQLObject.getWQLObject("st_ivt_sectattr"); - // 子卷包装关系表 - WQLObject subTab = WQLObject.getWQLObject("pdm_bi_subpackagerelation"); JSONArray rows = whereJson.getJSONArray("rows"); @@ -423,6 +450,7 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId()); jo_mst.put("upload_time", DateUtil.now()); WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); + } } @@ -451,7 +479,6 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { String stor_id = jo_mst.getString("stor_id"); JSONObject stor_jo = WQLObject.getWQLObject("ST_IVT_BSRealStorAttr").query("stor_id = '" + stor_id + "'").uniqueResult(0); String lgort = stor_jo.getString("ext_id"); - String is_virtualstore = stor_jo.getString("is_virtualstore"); String is_productstore = stor_jo.getString("is_productstore"); //生产入库 if (StrUtil.equals(bill_type, "0001")) { @@ -465,7 +492,13 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { JSONObject paramMesMst = new JSONObject(); paramMesMst.put("PackageBoxSN", box_row.getString("box_no")); paramMesMst.put("User", box_row.getString("confirm_optname")); + new LmsToMesServiceImpl().childRollFGInboundComplete(paramMesMst); + + jo_mst.put("is_upload", "1"); + jo_mst.put("upload_mes", "1"); + jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId()); + jo_mst.put("upload_time", DateUtil.now()); } } @@ -528,6 +561,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToSapServiceImpl().returnDelivery(param); + + jo_mst.put("upload_sap", "1"); + jo_mst.put("is_upload", "1"); + jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId()); + jo_mst.put("upload_time", DateUtil.now()); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } // 销售出库 if (StrUtil.equals(bill_type, "1001")) { @@ -591,8 +630,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToSapServiceImpl().returnDelivery(param); + jo_mst.put("upload_sap", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); + + // 2.回传mes - if (is_productstore.equals("1")){ + if (is_productstore.equals("1")) { JSONObject paramMesMst = new JSONObject(); String userName = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_USERNAME").getValue(); String passWord = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MES_PASSWORD").getValue(); @@ -619,6 +662,10 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst); + + jo_mst.put("upload_mes", "1"); + jo_mst.put("is_upload", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } } @@ -656,6 +703,9 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToSapServiceImpl().returnMoveDtl(paramMst); + jo_mst.put("upload_sap", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); + //调用母卷配送到位接口 JSONObject mes_jo = new JSONObject(); @@ -665,6 +715,10 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { mes_jo.put("package_box_sn", disArr.getJSONObject(0).getString("box_no")); mes_jo.put("warehouse", "3"); new LmsToMesServiceImpl().cutPlanMomRollDeliveryComplete(mes_jo); + + jo_mst.put("upload_mes", "1"); + jo_mst.put("is_upload", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } // 调拨出库 @@ -696,12 +750,12 @@ public class InAndOutRetrunServiceImpl implements InAndOutReturnService { // 调用接口回传 new LmsToMesServiceImpl().childRollFGOutboundComplete(paramMesMst); + + jo_mst.put("upload_mes", "1"); + jo_mst.put("is_upload", "1"); + WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } - jo_mst.put("is_upload", "1"); - jo_mst.put("upload_optid", SecurityUtils.getCurrentUserId()); - jo_mst.put("upload_time", DateUtil.now()); - WQLObject.getWQLObject("ST_IVT_IOStorInv").update(jo_mst); } } diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/wql/QST_IVT_INANDOUTRETRUN.wql b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/wql/QST_IVT_INANDOUTRETRUN.wql index cc7bbf6c0..bf8b68c6b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/wql/QST_IVT_INANDOUTRETRUN.wql +++ b/lms/nladmin-system/src/main/java/org/nl/wms/st/returns/wql/QST_IVT_INANDOUTRETRUN.wql @@ -22,6 +22,7 @@ 输入.is_upload TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.vbeln TYPEAS s_string 输入.bill_status TYPEAS s_string 输入.iostorinv_id TYPEAS s_string 输入.bill_code TYPEAS s_string @@ -29,6 +30,7 @@ 输入.io_type TYPEAS s_string 输入.material_type_id TYPEAS f_string 输入.iostorinv_id TYPEAS s_string + 输入.is_writeoff TYPEAS s_string 输入.ids TYPEAS f_string 输入.box_no TYPEAS s_string 输入.in_stor_id TYPEAS f_string @@ -61,6 +63,7 @@ SELECT DISTINCT mst.*, dtl.source_bill_type, + dtl.vbeln, user.nick_name AS upload_name FROM st_ivt_iostorinv mst @@ -80,6 +83,10 @@ dtl.pcsn = 输入.pcsn ENDOPTION + OPTION 输入.is_writeoff <> "" + mst.is_writeoff = 输入.is_writeoff + ENDOPTION + OPTION 输入.bill_status <> "" mst.bill_status = 输入.bill_status ENDOPTION @@ -114,6 +121,9 @@ OPTION 输入.end_time <> "" mst.input_time <= 输入.end_time ENDOPTION + OPTION 输入.vbeln <> "" + dtl.vbeln = 输入.vbeln + ENDOPTION OPTION 输入.material_search <> "" ( mb.material_code like 输入.material_search diff --git a/lms/nladmin-ui/src/views/wms/st/inAndOutReturn/index.vue b/lms/nladmin-ui/src/views/wms/st/inAndOutReturn/index.vue index bdd9db55b..996089c67 100644 --- a/lms/nladmin-ui/src/views/wms/st/inAndOutReturn/index.vue +++ b/lms/nladmin-ui/src/views/wms/st/inAndOutReturn/index.vue @@ -204,6 +204,8 @@ + +