From 9f6d45bd91c001bf9518cd412ad5e20b6745c018 Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Fri, 10 Dec 2021 10:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=9B=E5=BB=BA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=97=B6=E7=9A=84=E5=8F=82=E6=95=B0=E5=92=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E6=B5=81=E7=A8=8B=20=E4=BC=98=E5=8C=96=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=AE=8C=E6=88=90=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../empty/controller/CurrTaskController.java | 14 ++-- .../empty/controller/OrderInfoController.java | 2 +- .../mt/wms/empty/params/TaskCreateParam.java | 10 +-- .../service/impl/CurrTaskServiceImpl.java | 7 ++ .../service/impl/OrderInfoServiceImpl.java | 70 +++++++++++++++---- .../java/com/mt/wms/empty/vo/OrderInfoVo.java | 30 ++------ 6 files changed, 83 insertions(+), 50 deletions(-) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 18c17a3..9defeb6 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -67,11 +67,11 @@ public class CurrTaskController extends BaseController { String kilnCode = kilnInfoVoR.getData().getCode(); R bm = apmsControl.getStoveCodeByWorkShopCode("BM"); ArrayList> stoveCodes = bm.getData().getStoveCodes(); - //验证apms存在这个炉子 + //验证apms数据中存在这个炉子 boolean verifyCodes = false; ArrayList codeStr = new ArrayList<>(); stoveCodes.forEach(kilnMap -> { - codeStr.addAll(kilnMap.keySet()); + codeStr.add(kilnMap.get("code")); }); for (String s : codeStr) { @@ -83,7 +83,7 @@ public class CurrTaskController extends BaseController { } if (!verifyCodes) { - return failed(kilnCode + " 验证APMS炉号失败!"); + return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!"); } //通知apms创建一个生产单 @@ -91,8 +91,8 @@ public class CurrTaskController extends BaseController { apmsCreateSheet.setWorkShopCode("BM"); apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsCreateSheet.setTechCode(param.getCraftCode()); - //fixme 暂时没有user信息 - apmsCreateSheet.setStartUser(""); + //fixme 暂时没有正式user,使用测试账户 + apmsCreateSheet.setStartUser("QJJP03"); ArrayList createItems = new ArrayList<>(); param.getDetParams().forEach(e -> { CreateItem createItem = new CreateItem(); @@ -101,6 +101,7 @@ public class CurrTaskController extends BaseController { createItem.setWeight(e.getWeight().doubleValue()); createItems.add(createItem); }); + apmsCreateSheet.setStoveCode(kilnCode); apmsCreateSheet.setItems(createItems); R processSheet = apmsControl.createProcessSheet(apmsCreateSheet); @@ -114,11 +115,12 @@ public class CurrTaskController extends BaseController { CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); currTaskById.setSheetNo(sheetNo); currTaskService.updateCurrTaskById(currTaskById); + //生成详细任务中的检验结果数据在apms推送生产单结果时创建 return successful("创建成功,任务添加至等待执行队列。"); } else { - return failed("创建失败,APMS报错:" + processSheet.getMsg()); + return failed("创建失败,APMS报错:" + processSheet.getData().getMsg()); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoController.java index 750395f..df6b264 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/OrderInfoController.java @@ -70,7 +70,7 @@ public class OrderInfoController extends BaseController { @PostMapping(value = "completeOrder") - @ApiOperation(value = "完成订单") + @ApiOperation(value = "人工完成订单(不需通知apms,仅在wms完成)") @Deprecated private R completeOrder(@Validated @RequestBody IdParam idParam) { return orderInfoService.completeOrder(idParam); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskCreateParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskCreateParam.java index e3a15e9..90d1fe9 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskCreateParam.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/TaskCreateParam.java @@ -22,13 +22,13 @@ public class TaskCreateParam extends BaseParam { private static final long serialVersionUID = 1L; - @ApiModelProperty(value = "托盘号") - private String palletCode; - @ApiModelProperty(value = "起点", required = true) - private String startPosition; +// @ApiModelProperty(value = "托盘号") +// private String palletCode; +@ApiModelProperty(value = "起点(提升平台)", required = true) +private String startPosition; @ApiModelProperty(value = "终点位置", required = true) private String targetPosition; - @ApiModelProperty(value = "加工类型:0 初始加工,1 复加工 ,2 追加加工", required = true) + @ApiModelProperty(value = "加工类型:0 初始加工,1 复加工", required = true) private Integer processType; @ApiModelProperty(value = "窑炉Id", example = "1", required = true) private Long kilnId; diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index f317ff2..fd97c52 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mt.wms.core.api.Assert; import com.mt.wms.core.base.BaseService; import com.mt.wms.core.dal.entity.*; +import com.mt.wms.core.dal.service.CraftInfoServiceBiz; import com.mt.wms.core.dal.service.CurrTaskServiceBiz; import com.mt.wms.core.dal.service.OrderInfoServiceBiz; import com.mt.wms.core.params.BasePageParam; @@ -61,6 +62,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService @Autowired OrderInfoServiceBiz orderInfoServiceBiz; + @Autowired + CraftInfoServiceBiz craftInfoServiceBiz; @Override public CurrTaskVo getCurrTask(IdParam idParam) { @@ -87,6 +90,10 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService BeanUtils.copyProperties(param, currTask); currTask.setTaskType(TaskTypeEnum.WTK.getValue()); currTask.setTaskSource(0); + //根据工艺号查询工艺id以及工艺plc值 + CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CREATOR_ID, param.getCraftCode())); + currTask.setFCraftCodeId(one.getId()); + currTask.setFPlcValue(one.getPlcValue()); setCommonField(currTask); currTaskServiceBiz.save(currTask); return successful(IdVo.builder().id(currTask.getId()).build()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java index f12de12..245b0dd 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java @@ -17,6 +17,7 @@ import com.mt.wms.core.dal.entity.OrderInfo; import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz; import com.mt.wms.core.dal.service.CommunicationLogServiceBiz; import com.mt.wms.core.dal.service.OrderInfoServiceBiz; +import com.mt.wms.core.enums.WhetherEnum; import com.mt.wms.core.params.IdParam; import com.mt.wms.core.vo.PageVo; import com.mt.wms.core.vo.R; @@ -37,6 +38,7 @@ import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -92,13 +94,24 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic @Override public R> page(OrderInfoBasePageParam param) { - QueryWrapper wrapper=new QueryWrapper<>(); - wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()),OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum()) - .like(StringUtils.isNotBlank(param.getOrderNo()),OrderInfo.ORDER_NO, param.getOrderNo()) - .eq(OrderInfo.VALID,1) + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()), OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum()) + .like(StringUtils.isNotBlank(param.getOrderNo()), OrderInfo.ORDER_NO, param.getOrderNo()) + .eq(OrderInfo.VALID, 1) .orderByDesc(OrderInfo.CREATE_TIME); Page page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper); - return successful(new PageVo<>(page,OrderInfoVo.class)); + PageVo orderInfoVoPageVo = new PageVo<>(page, OrderInfoVo.class); + orderInfoVoPageVo.getRecords().forEach(e -> + { + R info = getTaskInfoByIdenCardNum(e.getIdenCardNum()); + e.setFinishWeight(info.getData().getFinishWeight()); + e.setFinishQuantity(info.getData().getQuantity()); + e.setWaitWeight(info.getData().getWaitWeight()); + e.setWaitQuantity(info.getData().getWaitQuantity()); + e.setReProcessQuantity(info.getData().getReProcessQuantity()); + e.setReProcessWeight(info.getData().getReProcessWeight()); + }); + return successful(orderInfoVoPageVo); } @Override @@ -117,7 +130,14 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic public R getOne(IdParam idParam) { OrderInfo byId = orderInfoService.getById(idParam.getId()); OrderInfoVo build = OrderInfoVo.builder().build(); - BeanUtils.copyProperties(byId,build); + BeanUtils.copyProperties(byId, build); + R info = getTaskInfoByIdenCardNum(build.getIdenCardNum()); + build.setFinishWeight(info.getData().getFinishWeight()); + build.setFinishQuantity(info.getData().getQuantity()); + build.setWaitWeight(info.getData().getWaitWeight()); + build.setWaitQuantity(info.getData().getWaitQuantity()); + build.setReProcessQuantity(info.getData().getReProcessQuantity()); + build.setReProcessWeight(info.getData().getReProcessWeight()); return successful(build); } @@ -179,8 +199,26 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic build.setFinishQuantity(sumTaskHis.get("quantity").floatValue()); build.setFinishWeight(sumTaskHis.get("weight").floatValue()); - build.setLastQuantity(build.getQuantity() - build.getFinishQuantity() - build.getWaitQuantity()); - build.setLastWeight(build.getWeight() - build.getFinishWeight() - build.getWaitWeight()); + // 考虑返工单的加工情况,添加到返工统计信息中。 + if (Objects.nonNull(one.getOldOrderNo())) + { + List list = orderInfoService.list(new QueryWrapper().eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_NO, one.getOldOrderNo())); + float reQuantity = 0; + float reWeight = 0; + for (OrderInfo orderInfo : list) + { + HashMap reCurrTask = currTaskDetService.getSumByIdCard(orderInfo.getIdenCardNum()); + reQuantity += reCurrTask.get("quantity").floatValue(); + reWeight += reCurrTask.get("weight").floatValue(); + + HashMap reTaskHis = taskDetHisService.getSumByIdCard(orderInfo.getIdenCardNum()); + reQuantity += reTaskHis.get("quantity").floatValue(); + reWeight += reTaskHis.get("weight").floatValue(); + } + build.setReProcessQuantity(reQuantity); + build.setReProcessWeight(reWeight); + } + return successful(build); } @@ -202,7 +240,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic byId.setValid(0); byId.setStatus(2); orderInfoService.updateById(byId); - return successful("操作成功。"); + return successful("订单状态成功置为完成。"); } @Override @@ -210,7 +248,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic OrderInfo byId = orderInfoService.getById(idParam.getId()); byId.setValid(0); orderInfoService.updateById(byId); - return successful("操作成功。"); + return successful("订单状态成功置为作废。"); } @Override @@ -231,13 +269,17 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic @Override public R apmsCompleteOrder(ApmsCompleteOrder apmsCompleteOrder) { //通过标识卡号与生产单号进行更新检验结果 - ApmsCheckResult one = apmsCheckResultServiceBiz.getOne(new QueryWrapper().eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum()).eq(ApmsCheckResult.SHEET_NO, apmsCompleteOrder.getSheetNo())); + ApmsCheckResult one = new ApmsCheckResult(); + one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); + one.setSheetNo(apmsCompleteOrder.getSheetNo()); + one.setCreateTime(LocalDateTime.now()); + one.setValid(WhetherEnum.YES.getValue()); one.setMetallography(apmsCompleteOrder.getMetallographic()); one.setHeartHardness(apmsCompleteOrder.getHeartHardness()); one.setHardness(apmsCompleteOrder.getHardness()); one.setUpdateTime(LocalDateTime.now()); - apmsCheckResultServiceBiz.updateById(one); - OrderInfo one1 = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo.IDEN_CARD_NUM, apmsCompleteOrder.getIdenCardNum())); - return completeOrder(IdParam.builder().id(one1.getId()).build()); + apmsCheckResultServiceBiz.save(one); + //订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms + return successful("任务执行完成。"); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/OrderInfoVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/OrderInfoVo.java index e887ce3..8bb80c0 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/OrderInfoVo.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/OrderInfoVo.java @@ -28,12 +28,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo { */ @ApiModelProperty(value = "主键") private Long id; - /** - * 删除标志,是否有效:1 可用 0不可用,2停止 - */ - @ApiModelProperty("删除标志") - private Integer valid; - /** * 来源:1.APMS 2.人工输入 */ @@ -45,18 +39,6 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo { @ApiModelProperty(value = "添加时间") private LocalDateTime createTime; - /** - * 创建人id - */ - @ApiModelProperty(value = "创建人id") - private Integer creatorId; - - /** - * 更新人id - */ - @ApiModelProperty(value = "更新人id") - private Integer updaterId; - /** * 修改时间,更具修改时间来判断下次执行顺序,第一次修改时间和新增时间相同 */ @@ -164,15 +146,15 @@ public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo { private Float waitQuantity; /** - * 剩余重量 完全未处理 + * 返工重量 返工单中计算的值 */ - @ApiModelProperty(value = "剩余重量") - private Float lastWeight; + @ApiModelProperty(value = "返工重量") + private Float reProcessWeight; /** - * 剩余数量 完全未处理 + * 返工数量 返工单中计算的值 */ - @ApiModelProperty(value = "剩余数量") - private Float lastQuantity; + @ApiModelProperty(value = "返工数量") + private Float reProcessQuantity; }