diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/rest/PhysicalMstController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/rest/PhysicalMstController.java index 78051793..551dc66d 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/rest/PhysicalMstController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/rest/PhysicalMstController.java @@ -107,4 +107,19 @@ public class PhysicalMstController { public ResponseEntity isMaterType(@RequestBody JSONObject json) { return new ResponseEntity<>(physicalMstService.isMaterType(json),HttpStatus.CREATED); } + + @GetMapping("/erpPhyQuery") + @Log("查询erp理化报告单") + @ApiOperation("查询erp理化报告单") + public ResponseEntity erpPhyQuery(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(physicalMstService.erpPhyQuery(whereJson, page), HttpStatus.OK); + } + + @PostMapping("/hpySync") + @Log("理化报告同步") + @ApiOperation("理化报告同步") + public ResponseEntity hpySync(@RequestBody JSONObject whereJson) { + physicalMstService.hpySync(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/PhysicalMstService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/PhysicalMstService.java index 18bda67d..e0309824 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/PhysicalMstService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/PhysicalMstService.java @@ -85,4 +85,19 @@ public interface PhysicalMstService { * @param json / */ JSONObject isMaterType(JSONObject json); + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map erpPhyQuery(Map whereJson, Pageable page); + + /** + * 理化报告同步 + * @param whereJson / + */ + void hpySync(JSONObject whereJson); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/InspectionsheetmstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/InspectionsheetmstServiceImpl.java index 72300524..a19d70ed 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/InspectionsheetmstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/InspectionsheetmstServiceImpl.java @@ -15,9 +15,12 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.nl.exception.BadRequestException; import org.nl.ext.lk.service.WmsToLkService; +import org.nl.ext.lk.service.impl.WmsToLkServiceImpl; import org.nl.modules.security.service.dto.JwtUserDto; +import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.util.CodeUtil; import org.nl.utils.SecurityUtils; +import org.nl.utils.SpringContextHolder; import org.nl.wms.basedata.master.constant.MaterOptTypeEnum; import org.nl.wms.basedata.master.service.MaterialbaseService; import org.nl.wms.pcs.Enum.ProcStatusEnum; @@ -259,7 +262,7 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService param.put("update_optname", nickName); param.put("update_time", now); sheetMstTab.delete(param); - sheetDtlTab.delete("inspection_id = '"+inspection_id+"'"); + sheetDtlTab.delete("inspection_id = '" + inspection_id + "'"); } } @@ -528,8 +531,8 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService * 如果是原辅料就执行一下代码 */ JSONArray IvtArr = new JSONArray(); - if(StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { - IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and quality_scode <> '01'").getResultJSONArray(0); + if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { + IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and quality_scode <> '01'").getResultJSONArray(0); } else if (StrUtil.equals(jsonDtl.getString("result"), "02")) { IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and quality_scode <> '02'").getResultJSONArray(0); } @@ -731,6 +734,27 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService checkOutBillService.insertDtlByJson(param); } } + /* + * 发送立库: + * 1.获取系统参数是否发送立库 + */ + String is_sendLK = SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("IS_SENDLK").getValue(); + if (StrUtil.equals(is_sendLK, "1")) { + WmsToLkServiceImpl wmsToLkService = new WmsToLkServiceImpl(); + + JSONObject param = new JSONObject(); + param.put("material_uuid", jsonMater.getString("ext_id")); + param.put("material_id", jsonMater.getString("material_id")); + param.put("material_code", jsonMater.getString("material_code")); + param.put("material_name", jsonMater.getString("material_name")); + param.put("status", jsonDtl.getString("result")); + + JSONObject result = wmsToLkService.qualityResult(param); + + if (StrUtil.equals(result.getString("result"), "2")) { + throw new BadRequestException("发送立库失败:"+result.getString("messsage")); + } + } } @@ -779,63 +803,63 @@ public class InspectionsheetmstServiceImpl implements InspectionsheetmstService .addParam("flag", "2") .addParam("material_id", jsonDtl.getString("material_id")) .addParam("pcsn", jsonDtl.getString("pcsn")).process().getResultJSONArray(0); - if (ObjectUtil.isNotEmpty(ivtDtlArr)) { - for (int j = 0; j < ivtDtlArr.size(); j++) { - JSONObject json = ivtDtlArr.getJSONObject(j); - JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0); - // 如果是合格或者是放行就存入 入库数 - if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { - jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty")); - // 如果是不合格就将入库数清0 - } else if (StrUtil.equals(jsonDtl.getString("result"), "02")) { - jsonReDtl.put("instor_qty", 0); - } - //判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中 - if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) { - jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode()); - } else { - jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode()); - } - reDtlTab.update(jsonReDtl); - /* - * 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成 - */ - JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0); - int flag = 0; - for (int i = 0; i < reDtlArr.size(); i++) { - JSONObject json1 = reDtlArr.getJSONObject(i); - if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) { - flag = flag + 1; - } - } - JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0); - if (reDtlArr.size() == flag) { - jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode()); - jsonReMst.put("confirm_optid", currentUserId); - jsonReMst.put("confirm_optname", nickName); - jsonReMst.put("confirm_time", now); - reMstTab.update(jsonReMst); - } - /* - * 如果到货单主表状态为确认,则需要更新采购订单接口处理表 - */ - if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) { - JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0); - // 到货数量 = 订单数量,为完成,否则为采购中 - if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) { - jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode()); - } else { - jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode()); - } - procTab.update(jsonProc); + if (ObjectUtil.isNotEmpty(ivtDtlArr)) { + for (int j = 0; j < ivtDtlArr.size(); j++) { + JSONObject json = ivtDtlArr.getJSONObject(j); + JSONObject jsonReDtl = reDtlTab.query("receivedtl_id = '" + json.getString("source_billdtl_id") + "'").uniqueResult(0); + // 如果是合格或者是放行就存入 入库数 + if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { + jsonReDtl.put("instor_qty", json.getDoubleValue("real_qty")); + // 如果是不合格就将入库数清0 + } else if (StrUtil.equals(jsonDtl.getString("result"), "02")) { + jsonReDtl.put("instor_qty", 0); + } + //判断到货明细表中的数量与到货入库数是否相等,相同就完成,不相等就到货中 + if (jsonReDtl.getDoubleValue("receive_qty") <= jsonReDtl.getDoubleValue("instor_qty")) { + jsonReDtl.put("status", ReceiveStatusEnum.AFFIRM.getCode()); + } else { + jsonReDtl.put("status", ReceiveStatusEnum.ARRIVAL_NOTICE.getCode()); + } + reDtlTab.update(jsonReDtl); + /* + * 判断到货明细单中的状态是否完成,全部完成则更新到货通知单主表完成 + */ + JSONArray reDtlArr = reDtlTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").getResultJSONArray(0); + int flag = 0; + for (int i = 0; i < reDtlArr.size(); i++) { + JSONObject json1 = reDtlArr.getJSONObject(i); + if (StrUtil.equals(json1.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) { + flag = flag + 1; } } + JSONObject jsonReMst = reMstTab.query("receive_id = '" + jsonReDtl.getString("receive_id") + "'").uniqueResult(0); + if (reDtlArr.size() == flag) { + jsonReMst.put("status", ReceiveStatusEnum.AFFIRM.getCode()); + jsonReMst.put("confirm_optid", currentUserId); + jsonReMst.put("confirm_optname", nickName); + jsonReMst.put("confirm_time", now); + reMstTab.update(jsonReMst); + } + /* + * 如果到货单主表状态为确认,则需要更新采购订单接口处理表 + */ + if (StrUtil.equals(jsonReMst.getString("status"), ReceiveStatusEnum.AFFIRM.getCode())) { + JSONObject jsonProc = procTab.query("id = '" + jsonReDtl.getString("source_billdtl_id") + "'").uniqueResult(0); + // 到货数量 = 订单数量,为完成,否则为采购中 + if ((jsonReDtl.getDoubleValue("instor_qty") >= jsonProc.getDoubleValue("qty")) && (StrUtil.equals(jsonReDtl.getString("status"), "99"))) { + jsonProc.put("proc_status", ProcStatusEnum.FULFILL.getCode()); + } else { + jsonProc.put("proc_status", ProcStatusEnum.BUYING_CENTER.getCode()); + } + procTab.update(jsonProc); + } } + } /* * 更新仓位库存表 */ JSONArray IvtArr = new JSONArray(); - if(StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { + if (StrUtil.equals(jsonDtl.getString("result"), "01") || StrUtil.equals(jsonDtl.getString("result"), "03")) { IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and quality_scode <> '01'").getResultJSONArray(0); } else if (StrUtil.equals(jsonDtl.getString("result"), "02")) { IvtArr = ivtTab.query("material_id = '" + jsonDtl.getString("material_id") + "' and pcsn = '" + jsonDtl.getString("pcsn") + "' and quality_scode <> '02'").getResultJSONArray(0); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/PhysicalMstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/PhysicalMstServiceImpl.java index 92351774..fdd68380 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/PhysicalMstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/service/impl/PhysicalMstServiceImpl.java @@ -929,6 +929,7 @@ public class PhysicalMstServiceImpl implements PhysicalMstService { } @Override + @Transactional(rollbackFor = Exception.class) public JSONObject isMaterType(JSONObject json) { String string = json.getString("material_id"); JSONObject jsonObject = new JSONObject(); @@ -944,4 +945,487 @@ public class PhysicalMstServiceImpl implements PhysicalMstService { return jsonObject; } + @Override + @Transactional(rollbackFor = Exception.class) + public Map erpPhyQuery(Map whereJson, Pageable page) { + String search_material_code = MapUtil.getStr(whereJson, "material_code"); + String search_pcsn = MapUtil.getStr(whereJson, "pcsn"); + + HashMap map = new HashMap<>(); + map.put("flag", "1"); + if (ObjectUtil.isNotEmpty(search_material_code)) map.put("search_material_code",search_material_code+"%"); + if (ObjectUtil.isNotEmpty(search_pcsn)) map.put("search_pcsn",search_pcsn+"%"); + + JSONObject json = WQL.getWO("QL_ERP").addParamMap(map).setDbname("dataSource1").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "biz_date"); + + return json; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void hpySync(JSONObject whereJson) { + JSONArray dataArr = whereJson.getJSONArray("data"); + + WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料信息表 + WQLObject phyMstTab = WQLObject.getWQLObject("QL_TEST_PhysicalMst"); // 理化报告主表 + + for (int i = 0; i < dataArr.size(); i++) { + JSONObject json = dataArr.getJSONObject(i); + // 1.将erp物料id转换成本系统物料id + String ext_id = json.getString("material_id"); + JSONObject jsonMater = materTab.query("ext_id = '" + ext_id + "' and is_delete = '0' and is_used = '1'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("此物料"+ext_id+"在mes系统不存在"); + + String material_id = jsonMater.getString("material_id"); + String pcsn = json.getString("pcsn"); + // 2.根据物料、批次查询理化报告单 查询是否有此物料、批次的理化报告 + JSONObject jsonPhyMst = phyMstTab.query("material_id = '" + material_id + "' and pcsn = '" + pcsn + "' and is_delete = '0'").uniqueResult(0); + // 3.如果理化报告不存在则是有问题 先跳过不做处理 + if (ObjectUtil.isEmpty(jsonPhyMst)) continue; + if (StrUtil.equals(jsonPhyMst.getString("bill_status"), "99")) { + throw new BadRequestException("此理化报告:"+jsonPhyMst.getString("inspection_code")+"已完成"); + } + + // 4.更新理化报告主表 + jsonPhyMst.put("result", json.getString("check_result")); + jsonPhyMst.put("grade", "01"); + jsonPhyMst.put("other_device_no", json.getString("other_device_no")); + jsonPhyMst.put("other_device_wd", json.getString("other_device_wd")); + jsonPhyMst.put("weightlost", json.getString("weightlost")); + jsonPhyMst.put("remark", json.getString("remark")); + jsonPhyMst.put("bill_status", "30"); + phyMstTab.update(jsonPhyMst); + + // 5.根据erp项点 插入理化报告明细 调用createPhyDtl() + json.put("inspection_id", jsonPhyMst.getString("inspection_id")); + this.createPhyDtl(json); + // 6.确认单据 + this.confirm(jsonPhyMst); + } + + } + + /** + * 查询理化质检检测项点 公共方法 + * @param item_code: 项点编码 / + * @return json + */ + @Transactional(rollbackFor = Exception.class) + public JSONObject queryItem(String item_code) { + WQLObject itemTab = WQLObject.getWQLObject("QL_TEST_InspectionItemPoint"); + JSONObject json = itemTab.query("inspection_item_code = '" + item_code + "' and inspection_item_type = '03' and is_delete = '0'").uniqueResult(0); + return json; + } + + /** + * 根据erp项点插入理化报告明细 + * @param json / + */ + @Transactional(rollbackFor = Exception.class) + public void createPhyDtl(JSONObject json) { + String inspection_id = json.getString("inspection_id"); + + WQLObject phyDtlTab = WQLObject.getWQLObject("QL_TEST_PhysicalDtl"); // 理化报告明细表 + + String item_code = ""; + JSONObject jsonDtlInsert = new JSONObject(); + + if (ObjectUtil.isNotEmpty(json.getString("midu"))) { + // 密度: LHZJ00001 + item_code = "LHZJ00001"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("midu")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("midu")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("hc"))) { + // 矫顽磁力: LHZJ00002 + item_code = "LHZJ00002"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("hc")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("hc")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("hra"))) { + // 硬度: LHZJ00003 + item_code = "LHZJ00003"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("hra")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("hra")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("ms"))) { + // 磁饱和: LHZJ00005 + item_code = "LHZJ00005"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("ms")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("ms")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("xa100"))) { + // 100XA: LHZJ00006 + item_code = "LHZJ00006"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xa100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xa100")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("xb100"))) { + // 100Xb: LHZJ00007 + item_code = "LHZJ00007"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xb100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xb100")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("xc100"))) { + // 100Xc: LHZJ00008 + item_code = "LHZJ00008"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xc100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xc100")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("xe100"))) { + // 100Xe: LHZJ00009 + item_code = "LHZJ00009"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xe100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xe100")); + phyDtlTab.insert(jsonDtlInsert); + } + } + +/* if (ObjectUtil.isNotEmpty(json.getString("x1500"))) { + // 1500x: LHZJ00009 + item_code = "LHZJ00009"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xe100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xe100")); + phyDtlTab.insert(jsonDtlInsert); + } + }*/ + + /* if (ObjectUtil.isNotEmpty(json.getString("shrink2"))) { + // 收缩系数: LHZJ00009 + item_code = "LHZJ00009"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("xe100")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("xe100")); + phyDtlTab.insert(jsonDtlInsert); + } + }*/ + + if (ObjectUtil.isNotEmpty(json.getString("jl10"))) { + // 10-15μ晶粒: LHZJ00012 + item_code = "LHZJ00012"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl10")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl10")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("jl15"))) { + // 15-20μ晶粒: LHZJ00013 + item_code = "LHZJ00013"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl15")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl15")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("jl20"))) { + // 20-25μ晶粒: LHZJ00014 + item_code = "LHZJ00014"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl20")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl20")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("jl25"))) { + // 25-30μ晶粒: LHZJ00015 + item_code = "LHZJ00015"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl25")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl25")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("jl30"))) { + // 30以上晶粒: LHZJ00018 + item_code = "LHZJ00018"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl30")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl30")); + phyDtlTab.insert(jsonDtlInsert); + } + } + + if (ObjectUtil.isNotEmpty(json.getString("jl_dia"))) { + // 最大晶粒尺寸: LHZJ00019 + item_code = "LHZJ00019"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl_dia")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl_dia")); + phyDtlTab.insert(jsonDtlInsert); + } + } + +/* if (ObjectUtil.isNotEmpty(json.getString("jl_num"))) { + // 结块样面个数: LHZJ00019 + item_code = "LHZJ00019"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl_dia")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl_dia")); + phyDtlTab.insert(jsonDtlInsert); + } + }*/ + +/* if (ObjectUtil.isNotEmpty(json.getString("jl_max"))) { + // 结块最大尺寸: LHZJ00019 + item_code = "LHZJ00019"; + // 1.调用查找项点的方法 + JSONObject jsonItem = this.queryItem(item_code); + // 2.判断此项点是否存在:存在则更新 不存在则插入 + String inspection_item_id = jsonItem.getString("inspection_item_id"); + JSONObject jsonDtl = phyDtlTab.query("inspection_id = '" + inspection_id + "' and inspection_item_id = '" + inspection_item_id + "'").uniqueResult(0); + + if (ObjectUtil.isNotEmpty(jsonDtl)) { + jsonDtl.put("value", json.getDoubleValue("jl_dia")); + phyDtlTab.update(jsonDtl); + } else { + jsonDtlInsert.put("inspectiondtl_id", IdUtil.getSnowflake(1,1).nextId()); + jsonDtlInsert.put("inspection_id",inspection_id); + jsonDtlInsert.put("seq_no",1); + jsonDtlInsert.put("inspection_item_id",inspection_item_id); + jsonDtlInsert.put("value",json.getDoubleValue("jl_dia")); + phyDtlTab.insert(jsonDtlInsert); + } + }*/ + + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/QL_ERP.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/QL_ERP.wql new file mode 100644 index 00000000..663b9766 --- /dev/null +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/QL_ERP.wql @@ -0,0 +1,63 @@ +[交易说明] + 交易名: erp理化报告单分页查询 + 所属模块: + 功能简述: + 版权所有: + 表引用: + 版本经历: + +[数据库] + --指定数据库,为空采用默认值,默认为db.properties中列出的第一个库 + +[IO定义] + ################################################# + ## 表字段对应输入参数 + ################################################# + 输入.flag TYPEAS s_string + 输入.search_material_code TYPEAS s_string + 输入.search_pcsn TYPEAS s_string + + +[临时表] + --这边列出来的临时表就会在运行期动态创建 + +[临时变量] + --所有中间过程变量均可在此处定义 + +[业务过程] + + ########################################## + # 1、输入输出检查 # + ########################################## + + + ########################################## + # 2、主过程前处理 # + ########################################## + + + ########################################## + # 3、业务主过程 # + ########################################## + + IF 输入.flag = "1" + PAGEQUERY + SELECT + * + FROM + QL_TEST_PHYSICAL + where + "is_effective" = '1' + AND "dr" = '0' + + OPTION 输入.search_material_code <> "" + "material_code" like 输入.search_material_code + ENDOPTION + + OPTION 输入.search_pcsn <> "" + "pcsn" like 输入.search_pcsn + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF \ No newline at end of file diff --git a/mes/qd/src/api/wms/ql/physicalMst.js b/mes/qd/src/api/wms/ql/physicalMst.js index 630b1bc7..f506928a 100644 --- a/mes/qd/src/api/wms/ql/physicalMst.js +++ b/mes/qd/src/api/wms/ql/physicalMst.js @@ -72,4 +72,12 @@ export function isMaterType(data) { }) } -export default { add, edit, del, getResult, saveResult, confirm, setValid, copyAdd, isMaterType } +export function hpySync(data) { + return request({ + url: 'api/physicalMst/hpySync', + method: 'post', + data + }) +} + +export default { add, edit, del, getResult, saveResult, confirm, setValid, copyAdd, isMaterType, hpySync } diff --git a/mes/qd/src/views/wms/ql/physicalMstConfirm/PhySyncDialog.vue b/mes/qd/src/views/wms/ql/physicalMstConfirm/PhySyncDialog.vue new file mode 100644 index 00000000..03f8d5de --- /dev/null +++ b/mes/qd/src/views/wms/ql/physicalMstConfirm/PhySyncDialog.vue @@ -0,0 +1,145 @@ + + + + diff --git a/mes/qd/src/views/wms/ql/physicalMstConfirm/index.vue b/mes/qd/src/views/wms/ql/physicalMstConfirm/index.vue index f9d69907..57f7c769 100644 --- a/mes/qd/src/views/wms/ql/physicalMstConfirm/index.vue +++ b/mes/qd/src/views/wms/ql/physicalMstConfirm/index.vue @@ -144,6 +144,16 @@ > 设置有效 + + 理化同步 + - + @@ -258,6 +268,7 @@ import Dialog1 from './Dialog1' import crudInspectionsheetmst from '@/api/wms/ql/inspectionsheetmst' import DateRangePicker from '@/components/DateRangePicker' import RelevancyDialog from '@/views/wms/ql/physicalMst/RelevancyDialog' +import PhySyncDialog from '@/views/wms/ql/physicalMstConfirm/PhySyncDialog' import crudMaterialbase from '@/api/wms/basedata/master/materialbase' const defaultForm = { @@ -279,7 +290,8 @@ export default { MaterDtl, DateRangePicker, Dialog1, - RelevancyDialog + RelevancyDialog, + PhySyncDialog }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { @@ -311,6 +323,7 @@ export default { del: ['admin', 'user:del'] }, RelevancyShow: false, + phySyncShow: false, rules: { inspection_type: [ { required: true, message: '质检单类型不能为空', trigger: 'blur' }