From 0b4795e92cab913d0933aa4c2887c5051c60b8c8 Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Wed, 5 Jan 2022 09:49:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=B8=BAapms=E6=A3=80=E9=AA=8C=E7=9A=84?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/core/dal/entity/ApmsCheckResult.java | 116 +++++++++++++++++- .../dal/mapper/ApmsCheckResultMapper.java | 2 +- .../core/dal/mapper/ApmsCheckResultMapper.xml | 20 ++- .../service/ApmsCheckResultServiceBiz.java | 2 +- .../impl/ApmsCheckResultServiceBizImpl.java | 2 +- .../wms/empty/params/ApmsCompleteOrder.java | 86 +++++++++++++ .../service/impl/OrderInfoServiceImpl.java | 21 +--- .../src/main/resources/config/application.yml | 4 +- 8 files changed, 228 insertions(+), 25 deletions(-) diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/ApmsCheckResult.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/ApmsCheckResult.java index 5c7be40..0e72168 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/ApmsCheckResult.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/ApmsCheckResult.java @@ -15,7 +15,7 @@ import java.time.LocalDateTime; *

* * @author mt - * @since 2021-12-29 + * @since 2022-01-05 */ @Data @EqualsAndHashCode(callSuper = false) @@ -79,7 +79,7 @@ public class ApmsCheckResult extends Model { private String idenCardNum; /** - * 硬度检验结果(合格、不合格、返工、作废) + * 硬度检验结果(待检验、合格、不合格、返工、作废) */ @TableField("hardness") private String hardness; @@ -120,6 +120,90 @@ public class ApmsCheckResult extends Model { @TableField("hardness_value_three") private String hardnessValueThree; + /** + * 金相检验渗碳淬火 渗碳层深度 + */ + @TableField("metallography_stch_stccsd") + private Float metallographyStchStccsd; + + /** + * 金相检验渗碳淬火 表面为马氏体、残余奥氏体(级) + */ + @TableField("metallography_stch_mstost") + private String metallographyStchMstost; + + /** + * 金相检验渗碳淬火 细小颗粒状碳化物 + */ + @TableField("metallography_stch_xxklzthw") + private String metallographyStchXxklzthw; + + /** + * 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级) + */ + @TableField("metallography_stch_dtmstyltst") + private String metallographyStchDtmstyltst; + + /** + * 金相检验整体淬火 基体为回火马氏体(级) + */ + @TableField("metallography_ztch_hhmst") + private String metallographyZtchHhmst; + + /** + * 金相检验整体淬火 基体为回火托式体(级) + */ + @TableField("metallography_ztch_hhtst") + private String metallographyZtchHhtst; + + /** + * 金相检验整体淬火 基体为回火素式体(级) + */ + @TableField("metallography_ztch_hhsst") + private String metallographyZtchHhsst; + + /** + * 金相检验氮化 表面亮白色的为氮化合物层深 + */ + @TableField("metallography_dh_dhhwcs") + private Float metallographyDhDhhwcs; + + /** + * 金相检验氮化 向内为扩散层深 + */ + @TableField("metallography_dh_kscs") + private Float metallographyDhKscs; + + /** + * 金相检验氮化 心部 + */ + @TableField("metallography_dh_xb") + private String metallographyDhXb; + + /** + * 金相检验表面淬火 表面为板条马氏体(级) + */ + @TableField("metallography_bmch_btmst") + private String metallographyBmchBtmst; + + /** + * 金相检验表面淬火 心部 + */ + @TableField("metallography_bmch_xb") + private String metallographyBmchXb; + + /** + * 金相检验 备注 + */ + @TableField("metallography_bz") + private String metallographyBz; + + /** + * 金相检验心部硬度 心部硬度检验结果 + */ + @TableField("metallography_xbyd_xbydjyjg") + private Float metallographyXbydXbydjyjg; + public static final String ID = "id"; @@ -153,6 +237,34 @@ public class ApmsCheckResult extends Model { public static final String HARDNESS_VALUE_THREE = "hardness_value_three"; + public static final String METALLOGRAPHY_STCH_STCCSD = "metallography_stch_stccsd"; + + public static final String METALLOGRAPHY_STCH_MSTOST = "metallography_stch_mstost"; + + public static final String METALLOGRAPHY_STCH_XXKLZTHW = "metallography_stch_xxklzthw"; + + public static final String METALLOGRAPHY_STCH_DTMSTYLTST = "metallography_stch_dtmstyltst"; + + public static final String METALLOGRAPHY_ZTCH_HHMST = "metallography_ztch_hhmst"; + + public static final String METALLOGRAPHY_ZTCH_HHTST = "metallography_ztch_hhtst"; + + public static final String METALLOGRAPHY_ZTCH_HHSST = "metallography_ztch_hhsst"; + + public static final String METALLOGRAPHY_DH_DHHWCS = "metallography_dh_dhhwcs"; + + public static final String METALLOGRAPHY_DH_KSCS = "metallography_dh_kscs"; + + public static final String METALLOGRAPHY_DH_XB = "metallography_dh_xb"; + + public static final String METALLOGRAPHY_BMCH_BTMST = "metallography_bmch_btmst"; + + public static final String METALLOGRAPHY_BMCH_XB = "metallography_bmch_xb"; + + public static final String METALLOGRAPHY_BZ = "metallography_bz"; + + public static final String METALLOGRAPHY_XBYD_XBYDJYJG = "metallography_xbyd_xbydjyjg"; + @Override protected Serializable pkVal() { return this.id; diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.java index c6bdb54..dc8d267 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.java @@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult; *

* * @author mt - * @since 2021-12-29 + * @since 2022-01-05 */ public interface ApmsCheckResultMapper extends BaseMapper { diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.xml index 3b2b71d..73bd745 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.xml +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/ApmsCheckResultMapper.xml @@ -20,12 +20,30 @@ + + + + + + + + + + + + + + id, valid, create_time, creator_id, updater_id, update_time, version, sheet_no, iden_card_num, hardness, - metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three + metallography, heart_hardness, remake, hardness_value_one, hardness_value_two, hardness_value_three, + metallography_stch_stccsd, metallography_stch_mstost, metallography_stch_xxklzthw, + metallography_stch_dtmstyltst, metallography_ztch_hhmst, metallography_ztch_hhtst, metallography_ztch_hhsst, + metallography_dh_dhhwcs, metallography_dh_kscs, metallography_dh_xb, metallography_bmch_btmst, + metallography_bmch_xb, metallography_bz, metallography_xbyd_xbydjyjg diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/ApmsCheckResultServiceBiz.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/ApmsCheckResultServiceBiz.java index d9b4a4b..a548cb4 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/ApmsCheckResultServiceBiz.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/ApmsCheckResultServiceBiz.java @@ -9,7 +9,7 @@ import com.mt.wms.core.dal.entity.ApmsCheckResult; *

* * @author mt - * @since 2021-12-29 + * @since 2022-01-05 */ public interface ApmsCheckResultServiceBiz extends IService { diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/ApmsCheckResultServiceBizImpl.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/ApmsCheckResultServiceBizImpl.java index 2152858..35cf4e3 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/ApmsCheckResultServiceBizImpl.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/ApmsCheckResultServiceBizImpl.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Service; *

* * @author mt - * @since 2021-12-29 + * @since 2022-01-05 */ @Service public class ApmsCheckResultServiceBizImpl extends ServiceImpl implements ApmsCheckResultServiceBiz { diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsCompleteOrder.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsCompleteOrder.java index 8b242d2..3cd1634 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsCompleteOrder.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/ApmsCompleteOrder.java @@ -41,6 +41,92 @@ public class ApmsCompleteOrder extends BaseParam { @ApiModelProperty(value = "硬度检验值3", required = false) private String hardnessValueThree; + + /** + * 金相检验渗碳淬火 渗碳层深度 + */ + @ApiModelProperty(value = "金相检验渗碳淬火 渗碳层深度") + private Float metallographyStchStccsd; + + /** + * 金相检验渗碳淬火 表面为马氏体、残余奥氏体(级) + */ + @ApiModelProperty(value = "金相检验渗碳淬火 表面为马氏体、残余奥氏体(级)") + private String metallographyStchMstost; + + /** + * 金相检验渗碳淬火 细小颗粒状碳化物 + */ + @ApiModelProperty(value = "金相检验渗碳淬火 细小颗粒状碳化物") + private String metallographyStchXxklzthw; + + /** + * 金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级) + */ + @ApiModelProperty(value = "金相检验渗碳淬火 心部为低碳马氏体加游离铁素体(级)") + private String metallographyStchDtmstyltst; + + /** + * 金相检验整体淬火 基体为回火马氏体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火马氏体(级)") + private String metallographyZtchHhmst; + + /** + * 金相检验整体淬火 基体为回火托式体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火托式体(级)") + private String metallographyZtchHhtst; + + /** + * 金相检验整体淬火 基体为回火素式体(级) + */ + @ApiModelProperty(value = "金相检验整体淬火 基体为回火素式体(级)") + private String metallographyZtchHhsst; + + /** + * 金相检验氮化 表面亮白色的为氮化合物层深 + */ + @ApiModelProperty(value = "金相检验氮化 表面亮白色的为氮化合物层深") + private Float metallographyDhDhhwcs; + + /** + * 金相检验氮化 向内为扩散层深 + */ + @ApiModelProperty(value = "金相检验氮化 向内为扩散层深") + private Float metallographyDhKscs; + + /** + * 金相检验氮化 心部 + */ + @ApiModelProperty(value = "金相检验氮化 心部") + private String metallographyDhXb; + + /** + * 金相检验表面淬火 表面为板条马氏体(级) + */ + @ApiModelProperty(value = "金相检验表面淬火 表面为板条马氏体(级)") + private String metallographyBmchBtmst; + + /** + * 金相检验表面淬火 心部 + */ + @ApiModelProperty(value = "金相检验表面淬火 心部") + private String metallographyBmchXb; + + /** + * 金相检验 备注 + */ + @ApiModelProperty(value = "金相检验 备注") + private String metallographyBz; + + /** + * 金相检验心部硬度 心部硬度检验结果 + */ + @ApiModelProperty(value = "金相检验心部硬度 心部硬度检验结果") + private Float metallographyXbydXbydjyjg; + + @ApiModelProperty(value = "备注", required = false) private String remake; } 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 823c40e..43f4e39 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 @@ -303,18 +303,11 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic { //通过标识卡号与生产单号进行检验结果存储 ApmsCheckResult one = new ApmsCheckResult(); - one.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); - one.setSheetNo(apmsCompleteOrder.getSheetNo()); + BeanUtils.copyProperties(apmsCompleteOrder, one); one.setCreateTime(LocalDateTime.now()); + one.setUpdateTime(LocalDateTime.now()); one.setValid(WhetherEnum.YES.getValue()); one.setMetallography(apmsCompleteOrder.getMetallographic()); - one.setHeartHardness(apmsCompleteOrder.getHeartHardness()); - one.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne()); - one.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo()); - one.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree()); - one.setHardness(apmsCompleteOrder.getHardness()); - one.setUpdateTime(LocalDateTime.now()); - one.setRemake(apmsCompleteOrder.getRemake()); apmsCheckResultServiceBiz.save(one); //订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms return successful("操作成功,接收检验结果完成。", ""); @@ -322,17 +315,9 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic else { //存在检验结果更新的情况。主管或其他人员可能会更改结果。 - one1.setIdenCardNum(apmsCompleteOrder.getIdenCardNum()); - one1.setSheetNo(apmsCompleteOrder.getSheetNo()); - one1.setValid(WhetherEnum.YES.getValue()); + BeanUtils.copyProperties(apmsCompleteOrder, one1); one1.setMetallography(apmsCompleteOrder.getMetallographic()); - one1.setHeartHardness(apmsCompleteOrder.getHeartHardness()); - one1.setHardnessValueOne(apmsCompleteOrder.getHardnessValueOne()); - one1.setHardnessValueTwo(apmsCompleteOrder.getHardnessValueTwo()); - one1.setHardnessValueThree(apmsCompleteOrder.getHardnessValueThree()); - one1.setHardness(apmsCompleteOrder.getHardness()); one1.setUpdateTime(LocalDateTime.now()); - one1.setRemake(apmsCompleteOrder.getRemake()); apmsCheckResultServiceBiz.updateById(one1); return successful("操作成功,更新检验结果完成。", ""); } diff --git a/6.program/wms-gateway/src/main/resources/config/application.yml b/6.program/wms-gateway/src/main/resources/config/application.yml index 9348986..0769217 100644 --- a/6.program/wms-gateway/src/main/resources/config/application.yml +++ b/6.program/wms-gateway/src/main/resources/config/application.yml @@ -88,7 +88,9 @@ wms: - /*/login - /*/wechatLogin - /*/mobileLogin - - /apms + - /apms/apmsCompleteOrder + - /apms/apmsPostOrder + - /apms/apmsVoidOrder #公共配置 common: From 9cc6ef98f92350a35d40d3227611afe2132530b0 Mon Sep 17 00:00:00 2001 From: lgh Date: Thu, 7 Jul 2022 23:50:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?apms=E7=9A=84ip=E7=AB=AF=E5=8F=A3=E5=8F=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=83=BD=E6=BA=90=E6=B6=88=E8=80=97?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BC=98=E5=8C=96=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=8D=95=E7=94=A8=E4=B8=B4=E6=97=B6=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E5=8F=B7=EF=BC=88=E5=89=8D=E7=AB=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=E8=A6=81=E6=94=B9=E5=9B=9E=EF=BC=89=20=E5=A4=9A?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8Cbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/empty/controller/ApmsController.java | 2 +- .../empty/controller/CurrTaskController.java | 2 +- .../service/impl/CurrTaskServiceImpl.java | 4 ++- .../mt/wms/empty/task/AsynRunTaskService.java | 2 +- .../com/mt/wms/empty/task/RunTaskUtils.java | 2 +- .../com/mt/wms/empty/task/ScheduledTask.java | 26 ++++++++++++++----- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java index d63a6a3..9f66f0f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java @@ -50,7 +50,7 @@ public class ApmsController extends BaseController { // static String Token = "eyJhbGciOiJIUzI1NiJ9.eyJkYXRlIjozMTkyNzU4NDk4ODA3LCJwbGF0Rm9ybUlkIjoyLCJhcGlLZXkiOiI3ZWU4ZjU5YmJhZWFlMjdlIiwiZXhwIjozMTkyNzU4NDk4LCJpYXQiOjE2Mzc1NTg0OTh9.RH3MRQr1dCBYW996-WXN69eXu1ZFblAQHfhZHNbTmCg"; static String Token = ""; static LocalDateTime TokenExpireTime = LocalDateTime.now(); - static String ApiAddress = "http://59.110.171.25:9010"; + static String ApiAddress = "http://192.168.1.109:80"; @PostMapping(value = "apmsPostOrder") @ApiOperation(value = "WMS接收APMS推送订单信息") 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 7816473..0333254 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 @@ -233,7 +233,7 @@ public class CurrTaskController extends BaseController { currTaskById.setSheetNo(sheetNo); currTaskService.updateCurrTaskById(currTaskById); //生成详细任务中的检验结果数据在apms推送生产单结果时创建 - return successful("创建成功,任务添加至等待执行队列。"); + //return successful("创建成功,任务添加至等待执行队列。"); } else 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 5170b4a..1eb3b1b 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 @@ -102,10 +102,12 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService BeanUtils.copyProperties(param, currTask); currTask.setTaskType(TaskTypeEnum.WTK.getValue()); //根据工艺号查询工艺id以及工艺plc值 - CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CREATOR_ID, param.getCraftCode())); + // TODO: 2022/7/7 工艺号临时 + CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CRAFT_CODE, 1)); currTask.setCraftCodeId(one.getId()); currTask.setPlcValue(one.getPlcValue()); currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); + currTask.setTaskCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); 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/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index 9e19563..d1808a3 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -132,7 +132,7 @@ public class AsynRunTaskService extends BaseService { //执行成功,托盘进炉 if (status==1){ // TODO: 2022/7/7 开始记录能源消耗 - //asynStartRecordConsume(currTaskId,currTask.getKilnId()); + asynStartRecordConsume(currTaskId,currTask.getKilnId()); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); //更新调度表状态为完成 runTask.setUpdateTime(LocalDateTime.now()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java index d60dec5..fe397e7 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java @@ -203,7 +203,7 @@ public class RunTaskUtils { } else { //当前加工步骤不为第一步 int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper().eq(AutoExeTask.T_TASK_ID, currTask.getId())); - if (secondCount == 2) { + if (secondCount == 1) { //当前为自动任务第二步 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper().eq(AutoExeTask.T_TASK_ID, currTask.getId())); //该自动任务的工艺类型为2,还有第三步 diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 573a980..e5870b3 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -179,7 +179,7 @@ public class ScheduledTask extends BaseService { /** * 查询加工完成的窑炉 */ - @Scheduled(fixedDelay = 1000*60*2) + //@Scheduled(fixedDelay = 1000*60*2) public void taskForStockToKiln() throws IOException { //两辆车是否都空闲,只有两辆车都空闲才被允许做任务 List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper().eq(VehicleInfo.STATUS, 0)); @@ -212,8 +212,9 @@ public class ScheduledTask extends BaseService { } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 - //@Scheduled(fixedDelay = 1000*30) + @Scheduled(fixedDelay = 1000*30) public void getFastValue(){ + logger.info("==采集高频能耗数据开始=="); //加工炉列表 List kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper().in(KilnInfo.TYPE,1,3)); for (KilnInfo kilnInfo:kilnInfoList @@ -230,6 +231,10 @@ public class ScheduledTask extends BaseService { Long kilnId = kilnInfo.getId(); String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); + if (currTaskId==0){ + logger.info("==当前加工的为手动加工任务,不记录能耗=="); + continue; + } //加工炉 if (kilnInfo.getType()==1){ //一号油搅拌转速 @@ -295,14 +300,16 @@ public class ScheduledTask extends BaseService { parGasValue3.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue3); } + } } + logger.info("==采集高频能耗数据结束=="); } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 - //@Scheduled(fixedDelay = 1000*60*3) + @Scheduled(fixedDelay = 1000*60*3) public void getSlowValue(){ - System.out.println("开始采集数据"); + logger.info("==开始采集低频数据=="); List kilnInfoList = kilnInfoServiceBiz.list(); for (KilnInfo kilnInfo:kilnInfoList ) { @@ -317,6 +324,10 @@ public class ScheduledTask extends BaseService { Long kilnId = kilnInfo.getId(); String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); + if (currTaskId==0){ + logger.info("==当前加工的为手动加工任务,不记录能耗=="); + continue; + } //加工炉 if (kilnInfo.getType()==1){ //实际温度 @@ -439,7 +450,7 @@ public class ScheduledTask extends BaseService { } } } - System.out.println("采集完成"); + logger.info("==结束采集低频数据=="); } //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, @@ -491,9 +502,10 @@ public class ScheduledTask extends BaseService { } //遍历正在工作炉子的报警变量,记录报警 - //@Scheduled(fixedDelay = 1000*30) + @Scheduled(fixedDelay = 1000*60) public void listenKilnAlarm(){ List kilnInfoList = kilnInfoServiceBiz.list(); + logger.info("==开始查询炉子是否有报警=="); for (KilnInfo kilnInfo:kilnInfoList ) { PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() @@ -545,7 +557,7 @@ public class ScheduledTask extends BaseService { } } } - + logger.info("==结束查询炉子是否有报警=="); } //监听车辆是否在线(暂时不用) From 81b9f5c45e191e79f1d35d388580c5347afc3ac9 Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Fri, 8 Jul 2022 15:43:11 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=AE=8B=E7=95=99=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/mt/wms/core/dal/entity/OrderInfo.java | 2 +- .../main/java/com/mt/wms/empty/controller/ApmsController.java | 1 - .../com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfo.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfo.java index 2b529de..7c2e1a5 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfo.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfo.java @@ -97,7 +97,7 @@ public class OrderInfo extends Model { private String orderNo; /** - * 原订单号,APMS系统获取 返单时才存在 + * 原订单号(对应原先的标识卡号),APMS系统获取 返单时才存在 */ @TableField("old_order_no") private String oldOrderNo; diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java index d63a6a3..a29038e 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java @@ -47,7 +47,6 @@ public class ApmsController extends BaseController { @Autowired private CommunicationLogServiceBiz communicationLogServiceBiz; - // static String Token = "eyJhbGciOiJIUzI1NiJ9.eyJkYXRlIjozMTkyNzU4NDk4ODA3LCJwbGF0Rm9ybUlkIjoyLCJhcGlLZXkiOiI3ZWU4ZjU5YmJhZWFlMjdlIiwiZXhwIjozMTkyNzU4NDk4LCJpYXQiOjE2Mzc1NTg0OTh9.RH3MRQr1dCBYW996-WXN69eXu1ZFblAQHfhZHNbTmCg"; static String Token = ""; static LocalDateTime TokenExpireTime = LocalDateTime.now(); static String ApiAddress = "http://59.110.171.25:9010"; 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 43f4e39..b08180d 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 @@ -216,7 +216,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic // 考虑返工单的加工情况,添加到返工统计信息中。 if (Objects.nonNull(one.getOldOrderNo())) { - List list = orderInfoService.list(new QueryWrapper().eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_NO, one.getOldOrderNo())); + List list = orderInfoService.list(new QueryWrapper().eq(OrderInfo.VALID, 1).eq(OrderInfo.IDEN_CARD_NUM, one.getOldOrderNo())); float reQuantity = 0; float reWeight = 0; for (OrderInfo orderInfo : list) From b12bd2294fee32cb4d8c5fb5a0a6ad3738d08f7f Mon Sep 17 00:00:00 2001 From: lgh Date: Fri, 8 Jul 2022 15:58:24 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../empty/controller/CurrTaskController.java | 4 +- .../wms/empty/params/CurrTaskQueryParam.java | 3 + .../service/impl/CurrTaskServiceImpl.java | 11 +++- .../service/impl/OrderInfoServiceImpl.java | 5 +- .../mt/wms/empty/task/AsynRunTaskService.java | 58 ++++++++++--------- .../com/mt/wms/empty/task/ScheduledTask.java | 10 ++-- 6 files changed, 52 insertions(+), 39 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 0333254..130a458 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 @@ -264,8 +264,8 @@ public class CurrTaskController extends BaseController { @PostMapping(value = "deleteBySheetNo") @ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)") - public R deleteBySheetNo(@Validated @RequestBody String sheetNo) { - return currTaskService.deleteBySheetNo(sheetNo); + public R deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) { + return currTaskService.deleteBySheetNo(param.getSheetNo()); } @PostMapping(value = "runTask") @ApiOperation(value = "执行任务") diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskQueryParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskQueryParam.java index a614906..df02d0d 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskQueryParam.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/CurrTaskQueryParam.java @@ -23,4 +23,7 @@ public class CurrTaskQueryParam extends BasePageParam { @ApiModelProperty(value = "车辆id") private String vehicleId; + private String sheetNo; + + } 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 1eb3b1b..325b04d 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 @@ -76,6 +76,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService RunTaskUtils runTaskUtils; @Autowired AutoExeTaskServiceBiz autoExeTaskServiceBiz; + @Autowired + KilnInfoServiceBiz kilnInfoServiceBiz; @Override public CurrTaskVo getCurrTask(IdParam idParam) { @@ -101,9 +103,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService CurrTask currTask = new CurrTask(); BeanUtils.copyProperties(param, currTask); currTask.setTaskType(TaskTypeEnum.WTK.getValue()); + KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId()); + //根据工艺号查询工艺id以及工艺plc值 - // TODO: 2022/7/7 工艺号临时 - CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CRAFT_CODE, 1)); + CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CRAFT_CODE, param.getCraftCode())); + currTask.setTargetPosition(kilnInfo.getCode()); currTask.setCraftCodeId(one.getId()); currTask.setPlcValue(one.getPlcValue()); currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); @@ -163,6 +167,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService return failed(apmsStartProcessR.getData().getMsg()); } } + if (byId.getStatus()==2){ + return failed("无法删除,任务已加工完成。"); + } return failed("无法删除,任务正在执行中。"); } 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 323444b..3b01619 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 @@ -165,8 +165,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic PageVo currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param); Assert.notNull("该订单暂无详细任务记录。", currOrderCurrTask.getRecords()); //获取车辆信息 - R> vehicle = vehicleService.list(new VehicleQueryParam()); - Map> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); + //R> vehicle = vehicleService.list(new VehicleQueryParam()); + //Map> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); //获取窑炉信息 R> kiln = kilnInfoService.list(new KilnInfoQueryParam()); Map> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId)); @@ -181,6 +181,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic orderInfo.setKilnId(currTask.getKilnId()); orderInfo.setStartPosition(currTask.getStartPosition()); orderInfo.setTargetPosition(currTask.getTargetPosition()); + orderInfo.setTaskCode(currTask.getTaskCode()); //orderInfo.setVehicleId(currTask.getVehicleId()); //获取窑炉和车辆的名称信息 if (orderInfo.getKilnId() != null) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index d1808a3..70f107d 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -148,7 +148,7 @@ public class AsynRunTaskService extends BaseService { vehicle.setStatus(0); vehicleInfoServiceBiz.updateById(vehicle); // TODO: 2022/7/6 上报apms加工单开始 - //apmsStartProcess(currTask); + apmsStartProcess(currTask); }else { runTask.setStatus(3); @@ -217,7 +217,7 @@ public class AsynRunTaskService extends BaseService { //执行成功,托盘进炉 if (status==1){ // TODO: 2022/7/7 - //asynStartRecordConsume(currTaskId,currTask.getKilnId()); + asynStartRecordConsume(currTaskId,currTask.getKilnId()); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); //更新调度表状态为完成 runTask.setUpdateTime(LocalDateTime.now()); @@ -244,7 +244,7 @@ public class AsynRunTaskService extends BaseService { vehicle.setStatus(0); vehicleInfoServiceBiz.updateById(vehicle); // TODO: 2022/7/6 上报apms生产单开始加工 - //apmsStartProcess(currTask); + apmsStartProcess(currTask); }else { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); @@ -417,7 +417,7 @@ public class AsynRunTaskService extends BaseService { if (status==1){ // TODO: 2022/7/7 加工完成,记录结束时能源消耗 - //asynEndRecordConsume(currTaskId,currTask.getKilnId()); + asynEndRecordConsume(currTaskId,currTask.getKilnId()); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); //更新关系表状态为完成 runTask.setUpdateTime(LocalDateTime.now()); @@ -437,7 +437,8 @@ public class AsynRunTaskService extends BaseService { vehicle.setStatus(0); vehicleInfoServiceBiz.updateById(vehicle); // TODO: 2022/7/6 上报apms加工完成 -/* ApmsEndProcess apmsEndProcess=new ApmsEndProcess(); + logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单!"); + ApmsEndProcess apmsEndProcess=new ApmsEndProcess(); apmsEndProcess.setEndTime(LocalDateTime.now().toString()); apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setSheetNo(currTask.getSheetNo()); @@ -458,6 +459,7 @@ public class AsynRunTaskService extends BaseService { return; } } + logger.info("任务:"+currTask.getTaskCode()+"开始上报apms完成生产单!"); ApmsFinishProcessSheet apmsFinishProcessSheet=new ApmsFinishProcessSheet(); apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo()); apmsFinishProcessSheet.setEndTime(LocalDateTime.now().toString()); @@ -477,7 +479,7 @@ public class AsynRunTaskService extends BaseService { R apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet); if (apmsFinishProcessSheetVoR.getCode()!=0){ logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败!"); - }*/ + } }else { runTask.setStatus(3); runTask.setUpdateTime(LocalDateTime.now()); @@ -581,7 +583,7 @@ public class AsynRunTaskService extends BaseService { PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() .eq(PlcNameSpace.EQ_ID, kilnId) .eq(PlcNameSpace.EQ_TYPE, 0)); - String nameSpaceNote = nameSpace.getNote(); + String nameSpaceNote = nameSpace.getName(); switch (kilnInfo.getType()){ //加工炉 case 1: @@ -600,7 +602,7 @@ public class AsynRunTaskService extends BaseService { parTemValue.setOilTankActTemValue(actualOilTemp.floatValue()); parTemValue.setKilnId(kilnId); parTemValue.setTaskId(currTaskId); - setCommonField(parTemValue); + parTemValue.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue); //电度值 Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); @@ -615,7 +617,7 @@ public class AsynRunTaskService extends BaseService { parEleValue.setTotalBat(electricalValue.floatValue()); parEleValue.setKilnId(kilnId); parEleValue.setTaskId(currTaskId); - setCommonField(parEleValue); + parEleValue.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue); //一号油搅拌转速 Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1"); @@ -626,7 +628,7 @@ public class AsynRunTaskService extends BaseService { parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue()); parRotSpeedValue.setKilnId(kilnId); parRotSpeedValue.setTaskId(currTaskId); - setCommonField(parRotSpeedValue); + parRotSpeedValue.setCreateTime(LocalDateTime.now()); parRotSpeedValueServiceBiz.save(parRotSpeedValue); //氮气 Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow"); @@ -649,7 +651,7 @@ public class AsynRunTaskService extends BaseService { parGasValue.setSetNitPotValue(setupCarbon.floatValue()); parGasValue.setKilnId(kilnId); parGasValue.setTaskId(currTaskId); - setCommonField(parGasValue); + parGasValue.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue); break; //回火炉 @@ -663,7 +665,7 @@ public class AsynRunTaskService extends BaseService { parTemValue2.setActTemValue(actualTemp.floatValue()); parTemValue2.setKilnId(kilnId); parTemValue2.setTaskId(currTaskId); - setCommonField(parTemValue2); + parTemValue2.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue2); //电度值 electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); @@ -678,7 +680,7 @@ public class AsynRunTaskService extends BaseService { parEleValue2.setTotalBat(electricalValue.floatValue()); parEleValue2.setKilnId(kilnId); parEleValue2.setTaskId(currTaskId); - setCommonField(parEleValue2); + parEleValue2.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue2); break; //氮化炉 @@ -701,7 +703,7 @@ public class AsynRunTaskService extends BaseService { parTemValue3.setFurnacePressure(furnacePressure.floatValue()); parTemValue3.setKilnId(kilnId); parTemValue3.setTaskId(currTaskId); - setCommonField(parTemValue3); + parTemValue3.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue3); //电度值 electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); @@ -716,7 +718,7 @@ public class AsynRunTaskService extends BaseService { parEleValue3.setTotalBat(electricalValue.floatValue()); parEleValue3.setKilnId(kilnId); parEleValue3.setTaskId(currTaskId); - setCommonField(parEleValue3); + parEleValue3.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue3); //实际氮势 actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); @@ -741,7 +743,7 @@ public class AsynRunTaskService extends BaseService { parGasValue3.setDecompositionRate(decompositionRate.floatValue()); parGasValue3.setKilnId(kilnId); parGasValue3.setTaskId(currTaskId); - setCommonField(parGasValue3); + parGasValue3.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue3); break; //清洗炉 @@ -759,7 +761,7 @@ public class AsynRunTaskService extends BaseService { parEleValue4.setTotalBat(electricalValue.floatValue()); parEleValue4.setKilnId(kilnId); parEleValue4.setTaskId(currTaskId); - setCommonField(parEleValue4); + parEleValue4.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue4); break; default: @@ -773,7 +775,7 @@ public class AsynRunTaskService extends BaseService { PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() .eq(PlcNameSpace.EQ_ID, kilnId) .eq(PlcNameSpace.EQ_TYPE, 0)); - String nameSpaceNote = nameSpace.getNote(); + String nameSpaceNote = nameSpace.getName(); switch (kilnInfo.getType()){ //加工炉 case 1: @@ -792,7 +794,7 @@ public class AsynRunTaskService extends BaseService { parTemValue.setOilTankActTemValue(actualOilTemp.floatValue()); parTemValue.setKilnId(kilnId); parTemValue.setTaskId(currTaskId); - setCommonField(parTemValue); + parTemValue.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue); //电度值 Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); @@ -807,7 +809,7 @@ public class AsynRunTaskService extends BaseService { parEleValue.setTotalBat(electricalValue.floatValue()); parEleValue.setKilnId(kilnId); parEleValue.setTaskId(currTaskId); - setCommonField(parEleValue); + parEleValue.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue); //一号油搅拌转速 Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1"); @@ -818,7 +820,7 @@ public class AsynRunTaskService extends BaseService { parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue()); parRotSpeedValue.setKilnId(kilnId); parRotSpeedValue.setTaskId(currTaskId); - setCommonField(parRotSpeedValue); + parRotSpeedValue.setCreateTime(LocalDateTime.now()); parRotSpeedValueServiceBiz.save(parRotSpeedValue); //氮气 Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow"); @@ -841,7 +843,7 @@ public class AsynRunTaskService extends BaseService { parGasValue.setSetNitPotValue(setupCarbon.floatValue()); parGasValue.setKilnId(kilnId); parGasValue.setTaskId(currTaskId); - setCommonField(parGasValue); + parGasValue.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue); break; //回火炉 @@ -855,7 +857,7 @@ public class AsynRunTaskService extends BaseService { parTemValue2.setActTemValue(actualTemp.floatValue()); parTemValue2.setKilnId(kilnId); parTemValue2.setTaskId(currTaskId); - setCommonField(parTemValue2); + parTemValue2.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue2); //电度值 electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); @@ -870,7 +872,7 @@ public class AsynRunTaskService extends BaseService { parEleValue2.setTotalBat(electricalValue.floatValue()); parEleValue2.setKilnId(kilnId); parEleValue2.setTaskId(currTaskId); - setCommonField(parEleValue2); + parEleValue2.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue2); break; //氮化炉 @@ -893,7 +895,7 @@ public class AsynRunTaskService extends BaseService { parTemValue3.setFurnacePressure(furnacePressure.floatValue()); parTemValue3.setKilnId(kilnId); parTemValue3.setTaskId(currTaskId); - setCommonField(parTemValue3); + parTemValue3.setCreateTime(LocalDateTime.now()); parTemValueServiceBiz.save(parTemValue3); //电度值 electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); @@ -908,7 +910,7 @@ public class AsynRunTaskService extends BaseService { parEleValue3.setTotalBat(electricalValue.floatValue()); parEleValue3.setKilnId(kilnId); parEleValue3.setTaskId(currTaskId); - setCommonField(parEleValue3); + parEleValue3.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue3); //实际氮势 actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); @@ -933,7 +935,7 @@ public class AsynRunTaskService extends BaseService { parGasValue3.setDecompositionRate(decompositionRate.floatValue()); parGasValue3.setKilnId(kilnId); parGasValue3.setTaskId(currTaskId); - setCommonField(parGasValue3); + parGasValue3.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue3); break; //清洗炉 @@ -951,7 +953,7 @@ public class AsynRunTaskService extends BaseService { parEleValue4.setTotalBat(electricalValue.floatValue()); parEleValue4.setKilnId(kilnId); parEleValue4.setTaskId(currTaskId); - setCommonField(parEleValue4); + parEleValue4.setCreateTime(LocalDateTime.now()); parEleValueServiceBiz.save(parEleValue4); break; default: diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index e5870b3..689c841 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -123,7 +123,7 @@ public class ScheduledTask extends BaseService { /** * 正在加工的加工任务详情 */ - //@Scheduled(fixedDelay = 1000*60) + @Scheduled(fixedDelay = 1000*60) public void screen() throws IOException { //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情 List currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.IS_IN, 1)); @@ -148,15 +148,15 @@ public class ScheduledTask extends BaseService { //剩余时间 Integer remainingTime=0; if (kilnInfo.getType()!=4){ - remainingTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramTimeRemain")); + remainingTime = Integer.parseInt(readPlc(nameSpace, "ProgramTimeRemain").toString()); } if(kilnInfo.getType()==1||kilnInfo.getType()==3){ //运行时间 - Integer runTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramRunTime")); + Integer runTime = Integer.parseInt(readPlc(nameSpace, "ProgramRunTime").toString()); setupTime=runTime+remainingTime; } if (kilnInfo.getType()==2){ - setupTime=Integer.parseInt(readPlcToString(nameSpace, "SetTime")); + setupTime=Integer.parseInt(readPlc(nameSpace, "SetTime").toString()); } nowCurrTask.setSetupTime(setupTime); nowCurrTask.setRemainingTime(remainingTime); @@ -179,7 +179,7 @@ public class ScheduledTask extends BaseService { /** * 查询加工完成的窑炉 */ - //@Scheduled(fixedDelay = 1000*60*2) + @Scheduled(fixedDelay = 1000*60*2) public void taskForStockToKiln() throws IOException { //两辆车是否都空闲,只有两辆车都空闲才被允许做任务 List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper().eq(VehicleInfo.STATUS, 0)); From 936dc5b71a8f8846fc96e1c6b265e65c5fff921b Mon Sep 17 00:00:00 2001 From: lgh Date: Fri, 8 Jul 2022 18:23:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E5=8A=A0?= =?UTF-8?q?=E4=B8=8Acode=20=E5=88=9B=E5=BB=BA=E5=A4=9A=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E7=9A=84currTask=E5=8F=AA=E4=B8=8A=E6=8A=A5=E4=B8=80=E6=AC=A1a?= =?UTF-8?q?pms=E5=88=9B=E5=BB=BA=E7=94=9F=E4=BA=A7=E5=8D=95=20=E5=A4=9A?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E4=BB=BB=E5=8A=A1=E5=85=A8=E9=83=A8=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=90=8E=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A4autoTask?= =?UTF-8?q?=20=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mt/wms/core/base/BaseSupport.java | 13 +++++ .../src/main/java/com/mt/wms/core/vo/R.java | 3 ++ .../empty/controller/CurrTaskController.java | 49 +++++++++++-------- .../service/impl/CurrTaskServiceImpl.java | 11 ++++- .../service/impl/OrderInfoServiceImpl.java | 8 +-- .../mt/wms/empty/task/AsynRunTaskService.java | 2 +- .../com/mt/wms/empty/task/ScheduledTask.java | 6 +-- 7 files changed, 61 insertions(+), 31 deletions(-) diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/base/BaseSupport.java b/6.program/wms-core/src/main/java/com/mt/wms/core/base/BaseSupport.java index 6b6c359..070be83 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/base/BaseSupport.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/base/BaseSupport.java @@ -100,6 +100,19 @@ public abstract class BaseSupport { protected R successful(String msg, T data) { return R.ok(msg, data); } + /** + *

+ * 请求成功 + *

+ * @param code 正确码 + * @param msg 提示内容 + * @param data 数据内容 + * @param 对象泛型 + * @return + */ + protected R successful(int code,String msg, T data) { + return R.ok(code,msg, data); + } /** *

diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java b/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java index 24279b0..2177e33 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java @@ -99,5 +99,8 @@ public class R implements Serializable { public static R ok(String msg, T data) { return new R().msg(msg).data(data); } + public static R ok(int code,String msg, T data) { + return new R().code(code).msg(msg).data(data); + } } 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 130a458..9908e72 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 @@ -139,6 +139,10 @@ public class CurrTaskController extends BaseController { @ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列") public R createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){ List detParams = autoCurrTaskParam.getTaskCreateParamList(); + Boolean apmsCreateProcessSheet=false; + String sheetNo=null; + int i=1; + R processSheet=null; //自动任务循环添加多条currTask AutoExeTask autoExeTask=new AutoExeTask(); for (TaskCreateParam param:detParams @@ -168,27 +172,30 @@ public class CurrTaskController extends BaseController { { return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!"); } + if (i==1){ + //通知apms创建一个生产单 + ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); + apmsCreateSheet.setWorkShopCode("BM"); + apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + apmsCreateSheet.setTechCode(param.getCraftCode()); + //fixme 暂时没有正式user,使用测试账户 + apmsCreateSheet.setStartUser("QJJP03"); + ArrayList createItems = new ArrayList<>(); + param.getDetParams().forEach(e -> { + CreateItem createItem = new CreateItem(); + createItem.setItemCode(e.getIdenCardNum()); + createItem.setQuantity(e.getQuantity().intValue()); + createItem.setWeight(e.getWeight().doubleValue()); + createItems.add(createItem); + }); + apmsCreateSheet.setStoveCode(kilnCode); + apmsCreateSheet.setItems(createItems); + processSheet = apmsControl.createProcessSheet(apmsCreateSheet); + apmsCreateProcessSheet=processSheet.getData().getSuccess(); + sheetNo=processSheet.getData().getSheetNo(); + } - //通知apms创建一个生产单 - ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); - apmsCreateSheet.setWorkShopCode("BM"); - apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); - apmsCreateSheet.setTechCode(param.getCraftCode()); - //fixme 暂时没有正式user,使用测试账户 - apmsCreateSheet.setStartUser("QJJP03"); - ArrayList createItems = new ArrayList<>(); - param.getDetParams().forEach(e -> { - CreateItem createItem = new CreateItem(); - createItem.setItemCode(e.getIdenCardNum()); - createItem.setQuantity(e.getQuantity().intValue()); - createItem.setWeight(e.getWeight().doubleValue()); - createItems.add(createItem); - }); - apmsCreateSheet.setStoveCode(kilnCode); - apmsCreateSheet.setItems(createItems); - R processSheet = apmsControl.createProcessSheet(apmsCreateSheet); - - if (processSheet.getData().getSuccess()) + if (apmsCreateProcessSheet) { //apms创建成功后写入数据库 R mainTask = currTaskService.createProcessTask(param); @@ -227,7 +234,6 @@ public class CurrTaskController extends BaseController { setUpdateCommonField(autoExeTask); autoExeTaskServiceBiz.updateById(autoExeTask); } - String sheetNo = processSheet.getData().getSheetNo(); //将返回的生产单号写入到主任务中。 CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); currTaskById.setSheetNo(sheetNo); @@ -240,6 +246,7 @@ public class CurrTaskController extends BaseController { { return failed("创建失败,APMS报错:" + processSheet.getData().getMsg()); } + i++; } return null; } 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 325b04d..947c93e 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 @@ -158,8 +158,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService R apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); if (apmsStartProcessR.getData().getSuccess()) { - currTaskServiceBiz.removeById(byId.getId()); - currTaskDetService.deleteByCurrTaskId(byId.getId()); + Long currTaskId = byId.getId(); + currTaskServiceBiz.removeById(currTaskId); + currTaskDetService.deleteByCurrTaskId(currTaskId); + if (byId.getIsAuto()==1){ + List currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId())); + if (currTaskList.size()==0){ + autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId()); + } + } return successful("APMS生产单删除成功。"); } else 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 950fdf7..b0a12f0 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 @@ -103,7 +103,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo()); } orderInfoService.save(orderInfo); - return successful("Wms接收Apms订单成功。", ""); + return successful(0,"Wms接收Apms订单成功。", ""); } @Override @@ -266,7 +266,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic byId.setUpdateTime(LocalDateTime.now()); byId.setOrderVoid(0); orderInfoService.updateById(byId); - return successful("操作成功,订单状态置为作废。", ""); + return successful(0,"操作成功,订单状态置为作废。", ""); } @Override @@ -311,7 +311,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic one.setMetallography(apmsCompleteOrder.getMetallographic()); apmsCheckResultServiceBiz.save(one); //订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms - return successful("操作成功,接收检验结果完成。", ""); + return successful(0,"操作成功,接收检验结果完成。", ""); } else { @@ -320,7 +320,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic one1.setMetallography(apmsCompleteOrder.getMetallographic()); one1.setUpdateTime(LocalDateTime.now()); apmsCheckResultServiceBiz.updateById(one1); - return successful("操作成功,更新检验结果完成。", ""); + return successful(0,"操作成功,更新检验结果完成。", ""); } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index 70f107d..5f5ec85 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -436,7 +436,7 @@ public class AsynRunTaskService extends BaseService { //更新小车状态 vehicle.setStatus(0); vehicleInfoServiceBiz.updateById(vehicle); - // TODO: 2022/7/6 上报apms加工完成 + // TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单,等所有加工步骤都完成后上报apms完成生产单。 logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单!"); ApmsEndProcess apmsEndProcess=new ApmsEndProcess(); apmsEndProcess.setEndTime(LocalDateTime.now().toString()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 689c841..18acbb5 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -148,15 +148,15 @@ public class ScheduledTask extends BaseService { //剩余时间 Integer remainingTime=0; if (kilnInfo.getType()!=4){ - remainingTime = Integer.parseInt(readPlc(nameSpace, "ProgramTimeRemain").toString()); + remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue(); } if(kilnInfo.getType()==1||kilnInfo.getType()==3){ //运行时间 - Integer runTime = Integer.parseInt(readPlc(nameSpace, "ProgramRunTime").toString()); + Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue(); setupTime=runTime+remainingTime; } if (kilnInfo.getType()==2){ - setupTime=Integer.parseInt(readPlc(nameSpace, "SetTime").toString()); + setupTime=readPlc(nameSpace, "SetTime").intValue(); } nowCurrTask.setSetupTime(setupTime); nowCurrTask.setRemainingTime(remainingTime);