| | |
| | | import com.ruoyi.common.core.domain.entity.InformationNotification; |
| | | import com.ruoyi.common.config.WechatProperty; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.InsReportExport; |
| | | import com.ruoyi.inspect.dto.ReportPageDto; |
| | |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | @Resource |
| | | private InsOrderService insOrderService; |
| | | @Resource |
| | | private WechatProperty wechatProperty; |
| | | // @Resource |
| | | // private WechatProperty wechatProperty; |
| | | @Resource |
| | | private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | @Resource |
| | | private IfsApiUtils ifsApiUtils; |
| | | @Resource |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | |
| | |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId())); |
| | | } |
| | | |
| | | threadPoolTaskExecutor.execute(() -> { |
| | | // 企业微信通知 |
| | | String message = ""; |
| | | message += "检测结果提交通知"; |
| | | message += "\n批次号: " + one.getUpdateBatchNo(); |
| | | message += "\n零件号: " + one.getPartNo(); |
| | | message += "\n零件描述: " + one.getPartDesc(); |
| | | message += "\n供应商名称: " + one.getSupplierName(); |
| | | message += "\n抵达数量: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas(); |
| | | // 发送企业inspectStatus信通知 |
| | | if (inspectStatus == 1) { |
| | | message += "\n检测结果: 合格"; |
| | | } else { |
| | | message += "\n检测结果: 不合格"; |
| | | } |
| | | WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | }); |
| | | // threadPoolTaskExecutor.execute(() -> { |
| | | // // 企业微信通知 |
| | | // String message = ""; |
| | | // message += "检测结果提交通知"; |
| | | // message += "\n批次号: " + one.getUpdateBatchNo(); |
| | | // message += "\n零件号: " + one.getPartNo(); |
| | | // message += "\n零件描述: " + one.getPartDesc(); |
| | | // message += "\n供应商名称: " + one.getSupplierName(); |
| | | // message += "\n抵达数量: " + one.getQtyArrived().stripTrailingZeros().toPlainString() + one.getBuyUnitMeas(); |
| | | // // 发送企业inspectStatus信通知 |
| | | // if (inspectStatus == 1) { |
| | | // message += "\n检测结果: 合格"; |
| | | // } else { |
| | | // message += "\n检测结果: 不合格"; |
| | | // } |
| | | // WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | // }); |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public String moveRawMaterial(IfsInventoryQuantity one) { |
| | | String toLocation; |
| | | // 登记采购检验结果STD |
| | | if (one.getIsRegister().equals(0)) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | map.put("LINE_NO", one.getLineNo()); // 行号 |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // 下达号 |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // 接收号 |
| | | map.put("PURCH_QTY", one.getQtyToInspect()); // 要检验的采购数量 |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "登记采购检验结果"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | Result result = ifsApiUtils.getProcurementResults(JSONUtil.toJsonStr(resultMap)); |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFS登记采购检验结果失败: " + result.getMessage()); |
| | | } |
| | | } |
| | | insOrderService.updateIfsInventoryQuantity(one.getId()); |
| | | /** |
| | | * TODO 后续需要调用IFS的接口 移入的库位号 toLocation |
| | | */ |
| | | // 检验后移库 |
| | | toLocation = "1301"; |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getQtyArrived()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getLotBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "检验后移库"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | // 如果有必须为零件指定批号报错需要重新提交移库信息去指定批号 |
| | | if (result1.getCode() != 200) { |
| | | String message = result1.getMessage(); |
| | | if (message.contains("必须为零件") && message.contains("指定批号")) { |
| | | updaeBatch(one, toLocation); |
| | | } else { |
| | | throw new ErrorException("IFS检验后移库失败: " + result1.getMessage()); |
| | | } |
| | | } |
| | | return toLocation; |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param toLocation |
| | | */ |
| | | private void updaeBatch(IfsInventoryQuantity one, String toLocation) { |
| | | if (one.getIsUpdateBatch().equals(0)) { |
| | | // 先修改批次号后进行移库 |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | map.put("LINE_NO", one.getLineNo()); // 行号 |
| | | map.put("RELEASE_NO", one.getReleaseNo()); // 下达号 |
| | | map.put("RECEIPT_NO", one.getReceiptNo()); // 接收号 |
| | | map.put("PART_NO", one.getPartNo()); //零件号 |
| | | map.put("CONFIGURATION_ID", one.getConfigurationId()); // 配置标识 |
| | | map.put("LOCATION_NO", one.getLocationNo()); // 库位号 |
| | | map.put("LOT_BATCH_NO", one.getLotBatchNo());// 批次号 |
| | | map.put("NEW_LOT_BATCH_NO", one.getUpdateBatchNo()); // 目标批次号 |
| | | map.put("SERIAL_NO", one.getSerialNo()); // 序列号 |
| | | map.put("ENG_CHG_LEVEL", one.getEngChgLevel()); // 版本号 |
| | | map.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); // wdr号 |
| | | map.put("ACTIVITY_SEQ", one.getActivitySeq()); // 活动序号 |
| | | map.put("QTY_TO_CHANGE", one.getQtyArrived()); // 变更数量 |
| | | resultList.add(map); |
| | | resultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | resultMap.put("SYSCODE", "LIMS"); |
| | | resultMap.put("SYSMODEL", "修改采购订单批次号"); |
| | | resultMap.put("BATCH_INFO", resultList); |
| | | |
| | | Result result = ifsApiUtils.updateMoveReceiptLot(JSONUtil.toJsonStr(resultMap)); |
| | | |
| | | if (result.getCode() != 200) { |
| | | throw new ErrorException("IFS修改批次号失败: " + result.getMessage()); |
| | | } |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsUpdateBatch, 1) |
| | | .eq(IfsInventoryQuantity::getId, one.getId())); |
| | | } |
| | | |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | | moveMap.put("ORDER_NO", one.getOrderNo()); // 采购订单号 |
| | | moveMap.put("LINE_NO", one.getLineNo()); |
| | | moveMap.put("RELEASE_NO", one.getReleaseNo()); |
| | | moveMap.put("RECEIPT_NO", one.getReceiptNo()); |
| | | moveMap.put("PART_NO", one.getPartNo()); |
| | | moveMap.put("QTY", one.getQtyArrived()); |
| | | moveMap.put("LOCATION_NO", one.getLocationNo()); |
| | | moveMap.put("TO_LOCATION_NO", toLocation); |
| | | moveMap.put("LOT_BATCH_NO", one.getUpdateBatchNo()); |
| | | moveMap.put("SERIAL_NO", one.getSerialNo()); |
| | | moveMap.put("WAIV_DEV_REJ_NO", one.getWaivDevRejNo()); |
| | | moveMap.put("ENG_CHG_LEVEL", one.getEngChgLevel()); |
| | | moveMap.put("ACTIVITY_SEQ", one.getActivitySeq()); |
| | | moveResultList.add(moveMap); |
| | | moveResultMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | moveResultMap.put("SYSCODE", "LIMS"); |
| | | moveResultMap.put("SYSMODEL", "检验后移库"); |
| | | moveResultMap.put("BATCH_INFO", moveResultList); |
| | | |
| | | Result result1 = ifsApiUtils.moveReceipt(JSONUtil.toJsonStr(moveResultMap)); |
| | | if (result1.getCode() != 200) { |
| | | throw new ErrorException("IFS检验后移库失败: " + result1.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |