From f68b45870fe92fb401964da46abfd7b1bd28fdf3 Mon Sep 17 00:00:00 2001 From: Lin-XCC <754310653@QQ.COM> Date: Fri, 26 Nov 2021 08:50:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0apms=E4=BD=9C=E5=BA=9F?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=8D=95=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=A1=A8=E6=96=B0=E5=A2=9E=E7=94=9F=E4=BA=A7=E5=8D=95?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mt/wms/core/dal/entity/CurrTask.java | 22 +++++++------ .../com/mt/wms/core/dal/entity/TaskHis.java | 22 +++++++------ .../mt/wms/core/dal/mapper/CurrTaskMapper.xml | 5 ++- .../mt/wms/core/dal/mapper/TaskHisMapper.xml | 5 ++- .../wms/empty/controller/ApmsController.java | 31 +++++++++++++++++-- .../empty/controller/CurrTaskController.java | 10 ++++-- .../wms/empty/service/CurrTaskDetService.java | 8 +++++ .../mt/wms/empty/service/CurrTaskService.java | 8 +++++ .../service/impl/CurrTaskDetServiceImpl.java | 6 ++++ .../service/impl/CurrTaskServiceImpl.java | 28 +++++++++++++++++ 10 files changed, 120 insertions(+), 25 deletions(-) diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CurrTask.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CurrTask.java index 885fb2a..2ad7408 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CurrTask.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CurrTask.java @@ -1,25 +1,21 @@ package com.mt.wms.core.dal.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.baomidou.mybatisplus.annotation.Version; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableField; -import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import java.io.Serializable; +import java.time.LocalDateTime; + /** *

* 当前任务 *

* * @author mt - * @since 2021-11-18 + * @since 2021-11-25 */ @Data @EqualsAndHashCode(callSuper = false) @@ -88,6 +84,12 @@ public class CurrTask extends Model { @TableField("task_code") private String taskCode; + /** + * 生产单号 APMS生成生产单后返回 + */ + @TableField("sheet_no") + private String sheetNo; + /** * 任务来源 0:人工 扩展字段 */ @@ -193,6 +195,8 @@ public class CurrTask extends Model { public static final String TASK_CODE = "task_code"; + public static final String SHEET_NO = "sheet_no"; + public static final String TASK_SOURCE = "task_source"; public static final String TASK_TYPE = "task_type"; diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/TaskHis.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/TaskHis.java index e1e530b..cf30ad8 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/TaskHis.java +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/TaskHis.java @@ -1,25 +1,21 @@ package com.mt.wms.core.dal.entity; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.extension.activerecord.Model; -import com.baomidou.mybatisplus.annotation.Version; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableField; -import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; +import java.io.Serializable; +import java.time.LocalDateTime; + /** *

* 任务历史 *

* * @author mt - * @since 2021-11-18 + * @since 2021-11-25 */ @Data @EqualsAndHashCode(callSuper = false) @@ -88,6 +84,12 @@ public class TaskHis extends Model { @TableField("task_code") private String taskCode; + /** + * 生产单号 APMS生成生产单后返回 + */ + @TableField("sheet_no") + private String sheetNo; + /** * 任务来源 0:人工 扩展字段 */ @@ -193,6 +195,8 @@ public class TaskHis extends Model { public static final String TASK_CODE = "task_code"; + public static final String SHEET_NO = "sheet_no"; + public static final String TASK_SOURCE = "task_source"; public static final String TASK_TYPE = "task_type"; diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CurrTaskMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CurrTaskMapper.xml index 0db46ac..d4fe1bd 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CurrTaskMapper.xml +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CurrTaskMapper.xml @@ -14,6 +14,7 @@ + @@ -32,7 +33,9 @@ - id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, task_source, task_type, process_type, pallet_code, a_begin_time, a_end_time, start_position, target_position, kiln_id, kiln_name, vehicle_id, is_cache, location_id, location_name + id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, sheet_no, + task_source, task_type, process_type, pallet_code, a_begin_time, a_end_time, start_position, target_position, + kiln_id, kiln_name, vehicle_id, is_cache, location_id, location_name diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/TaskHisMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/TaskHisMapper.xml index 3c467da..7c9d21d 100644 --- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/TaskHisMapper.xml +++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/TaskHisMapper.xml @@ -14,6 +14,7 @@ + @@ -32,7 +33,9 @@ - id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, task_source, task_type, process_type, pallet_code, a_begin_time, a_end_time, start_position, target_position, kiln_id, kiln_name, vehicle_id, is_cache, location_id, location_name + id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, task_code, sheet_no, + task_source, task_type, process_type, pallet_code, a_begin_time, a_end_time, start_position, target_position, + kiln_id, kiln_name, vehicle_id, is_cache, location_id, location_name 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 7f9168c..ab2f690 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 @@ -65,11 +65,11 @@ public class ApmsController extends BaseController { } @PostMapping(value = "apmsVoidOrder") - @ApiOperation(value = "APMS作废订单") + @ApiOperation(value = "APMS通知WMS作废订单") public R apmsVoidOrder(@Validated @RequestBody String idenCardNum) { CommunicationLog communicationLog = new CommunicationLog(); communicationLog.setCode("APMS" + System.currentTimeMillis()); - communicationLog.setLogName("APMS作废订单"); + communicationLog.setLogName("APMS通知WMS作废订单"); communicationLog.setType(3); communicationLog.setContent(idenCardNum); setCommonField(communicationLog); @@ -91,6 +91,31 @@ public class ApmsController extends BaseController { return orderInfoService.apmsCompleteOrder(apmsCompleteOrder); } + + /** + * 通过生产单编号删除生产单,如果生产单加工完成,不允许删除 + * + * @param sheetNo 生产单编号 + * @return + */ + @PostMapping(value = "deleteBySheetNo") + @ApiOperation(value = "通知APMS删除生产单") + public R deleteBySheetNo(@Validated @RequestBody String sheetNo) { + checkToken(); + HashMap paramMap = new HashMap<>(); + paramMap.put("sheetNo", sheetNo); + HttpResponse response = HttpUtil.createGet(ApiAddress + "/platform/api/deleteBySheetNo") + .header("token", Token).form(paramMap).execute(); + CommunicationLog communicationLog = new CommunicationLog(); + communicationLog.setCode("APMS" + System.currentTimeMillis()); + communicationLog.setLogName("WMS通知APMS删除生产单"); + communicationLog.setType(2); + communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); + setCommonField(communicationLog); + communicationLogServiceBiz.save(communicationLog); + return successful(JSONUtil.toBean(response.body(), ApmsEndProcessVo.class)); + } + @PostMapping(value = "createProcessSheet") @ApiOperation(value = "通知APMS创建生产单接口") public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) { @@ -191,7 +216,7 @@ public class ApmsController extends BaseController { .header("token", Token).form(paramMap).execute(); CommunicationLog communicationLog = new CommunicationLog(); communicationLog.setCode("APMS" + System.currentTimeMillis()); - communicationLog.setLogName("APMS通过车间编码获取炉号信息"); + communicationLog.setLogName("WMS通过APMS使用车间编码获取炉号信息"); communicationLog.setType(2); communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body()); setCommonField(communicationLog); 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 f69eabc..813a103 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 @@ -38,7 +38,7 @@ public class CurrTaskController extends BaseController { @PostMapping(value = "createProcessTask") @ApiOperation(value = "创建一个加工任务至任务队列") - public R createProcessTask(@Validated @RequestBody TaskCreateParam param) { + public R createProcessTask(@Validated @RequestBody TaskCreateParam param) { R mainTask = currTaskService.createProcessTask(param); currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId()); return successful("创建成功。"); @@ -53,7 +53,13 @@ public class CurrTaskController extends BaseController { @PostMapping(value = "completeTask") @ApiOperation(value = "完成执行任务") - public R completeTask(@Validated @RequestBody IdParam param) { + public R completeTask(@Validated @RequestBody IdParam param) { return currTaskService.completeTask(param); } + + @PostMapping(value = "deleteBySheetNo") + @ApiOperation(value = "通过生产单编号删除生产单(APMS)") + public R deleteBySheetNo(@Validated @RequestBody String sheetNo) { + return currTaskService.deleteBySheetNo(sheetNo); + } } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskDetService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskDetService.java index c691eb6..1f484e4 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskDetService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskDetService.java @@ -58,4 +58,12 @@ public interface CurrTaskDetService { * @return 结果 */ List getTaskDetailsByIdenCardNum(String idenCardNum); + + /** + * 查询某个标识卡号的详细任务列表 + * + * @param currTaskId 生产单号 + * @return 结果 + */ + R deleteByCurrTaskId(Long currTaskId); } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java index 4f1ccec..8ce07f6 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java @@ -49,4 +49,12 @@ public interface CurrTaskService { * @return 结果 */ R completeTask(IdParam param); + + /** + * 通过生产单编号删除生产单 + * + * @param sheetNo 生产单号 + * @return 结果 + */ + R deleteBySheetNo(String sheetNo); } diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskDetServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskDetServiceImpl.java index 9bbd583..a752f3c 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskDetServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskDetServiceImpl.java @@ -79,4 +79,10 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe .eq(CurrTaskDet.VALID, 1); return currTaskDetServiceBiz.list(queryWrapper); } + + @Override + public R deleteByCurrTaskId(Long currTaskId) { + currTaskDetServiceBiz.remove(new QueryWrapper().eq(CurrTaskDet.CURR_TASK_ID, currTaskId)); + return successful("成功。"); + } } 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 2073ed8..6ca8d49 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 @@ -12,6 +12,7 @@ import com.mt.wms.core.params.IdParam; import com.mt.wms.core.vo.IdVo; import com.mt.wms.core.vo.PageVo; import com.mt.wms.core.vo.R; +import com.mt.wms.empty.controller.ApmsController; import com.mt.wms.empty.enums.TaskTypeEnum; import com.mt.wms.empty.params.CurrTaskQueryParam; import com.mt.wms.empty.params.TaskCreateParam; @@ -19,6 +20,7 @@ import com.mt.wms.empty.service.CurrTaskDetService; import com.mt.wms.empty.service.CurrTaskService; import com.mt.wms.empty.service.TaskDetHisService; import com.mt.wms.empty.service.TaskHisService; +import com.mt.wms.empty.vo.ApmsEndProcessVo; import com.mt.wms.empty.vo.CurrTaskQueryVo; import com.mt.wms.empty.vo.CurrTaskVo; import org.apache.commons.lang.StringUtils; @@ -52,6 +54,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService @Autowired TaskDetHisService taskDetHisService; + @Autowired + ApmsController apmsControl; + @Override public CurrTaskVo getCurrTask(IdParam idParam) { CurrTask byId = currTaskServiceBiz.getById(idParam.getId()); @@ -99,4 +104,27 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService taskDetHisService.saveList(taskDetHis); return successful("执行成功。"); } + + @Override + public R deleteBySheetNo(String sheetNo) { + CurrTask byId = currTaskServiceBiz.getById(new QueryWrapper().eq(CurrTask.SHEET_NO, sheetNo)); + //如果尚未执行(状态 0) + if (byId.getStatus() == 0) + { + + R apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); + if (apmsStartProcessR.getData().getSuccess()) + { + currTaskServiceBiz.removeById(byId.getId()); + currTaskDetService.deleteByCurrTaskId(byId.getId()); + return successful("APMS生产单删除成功。"); + } + else + { + return failed(apmsStartProcessR.getData().getMsg()); + } + } + return failed("无法删除,任务正在执行中。"); + + } }