diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CraftInfo.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CraftInfo.java
new file mode 100644
index 0000000..7698dc9
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/CraftInfo.java
@@ -0,0 +1,137 @@
+package com.mt.wms.core.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *
+ * 设备工艺信息
+ *
+ *
+ * @author mt
+ * @since 2021-12-09
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("t_craft_info")
+public class CraftInfo extends Model {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 删除标志,是否有效:1 可用 0不可用,2停止
+ */
+ @TableField("valid")
+ @TableLogic
+ private Integer valid;
+
+ /**
+ * 添加时间,入库时间
+ */
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ /**
+ * 创建人id
+ */
+ @TableField("creator_id")
+ private Integer creatorId;
+
+ /**
+ * 更新人id
+ */
+ @TableField("updater_id")
+ private Integer updaterId;
+
+ /**
+ * 修改时间,更具修改时间来判断下次执行顺序,第一次修改时间和新增时间相同
+ */
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+ /**
+ * 版本号 默认为 1
+ */
+ @TableField("version")
+ @Version
+ private String version;
+
+ /**
+ * 状态,0:可用,1:不可用
+ */
+ @TableField("status")
+ private Integer status;
+
+ /**
+ * 内部编码,系统自动生成
+ */
+ @TableField("inter_code")
+ private String interCode;
+
+ /**
+ * 工艺号
+ */
+ @TableField("craft_code")
+ private String craftCode;
+
+ /**
+ * 编码
+ */
+ @TableField("code")
+ private String code;
+
+ /**
+ * 对应PLC值
+ */
+ @TableField("plc_value")
+ private Integer plcValue;
+
+ /**
+ * 说明
+ */
+ @TableField("content")
+ private String content;
+
+
+ public static final String ID = "id";
+
+ public static final String VALID = "valid";
+
+ public static final String CREATE_TIME = "create_time";
+
+ public static final String CREATOR_ID = "creator_id";
+
+ public static final String UPDATER_ID = "updater_id";
+
+ public static final String UPDATE_TIME = "update_time";
+
+ public static final String VERSION = "version";
+
+ public static final String STATUS = "status";
+
+ public static final String INTER_CODE = "inter_code";
+
+ public static final String CRAFT_CODE = "craft_code";
+
+ public static final String CODE = "code";
+
+ public static final String PLC_VALUE = "plc_value";
+
+ public static final String CONTENT = "content";
+
+ @Override
+ protected Serializable pkVal() {
+ return this.id;
+ }
+
+}
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..a2c413a 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-12-09
*/
@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:人工 扩展字段
*/
@@ -172,6 +174,18 @@ public class CurrTask extends Model {
@TableField("location_name")
private String locationName;
+ /**
+ * 工艺号ID,关联工艺号表:t_craft_info
+ */
+ @TableField("f_craft_code_id")
+ private Long fCraftCodeId;
+
+ /**
+ * 工艺号对应PLC值
+ */
+ @TableField("f_plc_value")
+ private Integer fPlcValue;
+
public static final String ID = "id";
@@ -193,6 +207,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";
@@ -221,6 +237,10 @@ public class CurrTask extends Model {
public static final String LOCATION_NAME = "location_name";
+ public static final String F_CRAFT_CODE_ID = "f_craft_code_id";
+
+ public static final String F_PLC_VALUE = "f_plc_value";
+
@Override
protected Serializable pkVal() {
return this.id;
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 e561ad4..1636215 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
@@ -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-12-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@@ -100,6 +96,12 @@ public class OrderInfo extends Model {
@TableField("order_no")
private String orderNo;
+ /**
+ * 原订单号,APMS系统获取 返单时才存在
+ */
+ @TableField("old_order_no")
+ private String oldOrderNo;
+
/**
* 标识卡号,APMS系统获取
*/
@@ -209,6 +211,8 @@ public class OrderInfo extends Model {
public static final String ORDER_NO = "order_no";
+ public static final String OLD_ORDER_NO = "old_order_no";
+
public static final String IDEN_CARD_NUM = "iden_card_num";
public static final String CUSTOMER_NO = "customer_no";
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfoHis.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfoHis.java
index f09911a..4c599ec 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfoHis.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/OrderInfoHis.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-12-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@@ -100,6 +96,12 @@ public class OrderInfoHis extends Model {
@TableField("order_no")
private String orderNo;
+ /**
+ * 原订单号,APMS系统获取,返工单才存在
+ */
+ @TableField("old_order_no")
+ private String oldOrderNo;
+
/**
* 标识卡号,APMS系统获取
*/
@@ -185,6 +187,8 @@ public class OrderInfoHis extends Model {
public static final String ORDER_NO = "order_no";
+ public static final String OLD_ORDER_NO = "old_order_no";
+
public static final String IDEN_CARD_NUM = "iden_card_num";
public static final String CUSTOMER_NO = "customer_no";
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..b3d00b9 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-12-09
*/
@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:人工 扩展字段
*/
@@ -172,6 +174,18 @@ public class TaskHis extends Model {
@TableField("location_name")
private String locationName;
+ /**
+ * 工艺号ID,关联工艺号表:t_craft_info
+ */
+ @TableField("f_craft_code_id")
+ private Long fCraftCodeId;
+
+ /**
+ * 工艺号对应PLC值
+ */
+ @TableField("f_plc_value")
+ private Integer fPlcValue;
+
public static final String ID = "id";
@@ -193,6 +207,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";
@@ -221,6 +237,10 @@ public class TaskHis extends Model {
public static final String LOCATION_NAME = "location_name";
+ public static final String F_CRAFT_CODE_ID = "f_craft_code_id";
+
+ public static final String F_PLC_VALUE = "f_plc_value";
+
@Override
protected Serializable pkVal() {
return this.id;
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.java
new file mode 100644
index 0000000..03289f5
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.mt.wms.core.dal.entity.CraftInfo;
+
+/**
+ *
+ * 设备工艺信息 Mapper 接口
+ *
+ *
+ * @author mt
+ * @since 2021-12-09
+ */
+public interface CraftInfoMapper extends BaseMapper {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.xml
new file mode 100644
index 0000000..953ee3e
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/CraftInfoMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, craft_code, code,
+ plc_value, content
+
+
+
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..375bce2 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,25 +14,30 @@
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
- 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, f_craft_code_id, f_plc_value
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoHisMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoHisMapper.xml
index 0476782..352684c 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoHisMapper.xml
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoHisMapper.xml
@@ -16,6 +16,7 @@
+
@@ -30,7 +31,9 @@
- id, valid, create_time, creator_id, updater_id, update_time, version, order_source, status, inter_code, code, order_no, iden_card_num, customer_no, customer_name, product_name, product_model, material_des, craft_ill, unit, weight, quantity
+ id, valid, create_time, creator_id, updater_id, update_time, version, order_source, status, inter_code, code,
+ order_no, old_order_no, iden_card_num, customer_no, customer_name, product_name, product_model, material_des,
+ craft_ill, unit, weight, quantity
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoMapper.xml
index c1efe7b..1131b73 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoMapper.xml
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/OrderInfoMapper.xml
@@ -16,6 +16,7 @@
+
@@ -34,7 +35,9 @@
- id, valid, create_time, creator_id, updater_id, update_time, version, order_source, status, inter_code, code, order_no, iden_card_num, customer_no, customer_name, product_name, product_model, material_des, craft_ill, unit, weight, quantity, add_a, add_b, orther_a, orther_b
+ id, valid, create_time, creator_id, updater_id, update_time, version, order_source, status, inter_code, code,
+ order_no, old_order_no, iden_card_num, customer_no, customer_name, product_name, product_model, material_des,
+ craft_ill, unit, weight, quantity, add_a, add_b, orther_a, orther_b
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..d6710d4 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,25 +14,30 @@
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
- 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, f_craft_code_id, f_plc_value
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/CraftInfoServiceBiz.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/CraftInfoServiceBiz.java
new file mode 100644
index 0000000..087fa8c
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/CraftInfoServiceBiz.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.mt.wms.core.dal.entity.CraftInfo;
+
+/**
+ *
+ * 设备工艺信息 服务类
+ *
+ *
+ * @author mt
+ * @since 2021-12-09
+ */
+public interface CraftInfoServiceBiz extends IService {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/CraftInfoServiceBizImpl.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/CraftInfoServiceBizImpl.java
new file mode 100644
index 0000000..af0e7d9
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/CraftInfoServiceBizImpl.java
@@ -0,0 +1,20 @@
+package com.mt.wms.core.dal.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.mt.wms.core.dal.entity.CraftInfo;
+import com.mt.wms.core.dal.mapper.CraftInfoMapper;
+import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 设备工艺信息 服务实现类
+ *
+ *
+ * @author mt
+ * @since 2021-12-09
+ */
+@Service
+public class CraftInfoServiceBizImpl extends ServiceImpl implements CraftInfoServiceBiz {
+
+}
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 3770983..67e607f 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
@@ -1,5 +1,6 @@
package com.mt.wms.empty.controller;
+import cn.hutool.http.ContentType;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSON;
@@ -8,9 +9,14 @@ import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.CommunicationLog;
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
+import com.mt.wms.core.enums.WhetherEnum;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.*;
import com.mt.wms.empty.service.OrderInfoService;
+import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
+import com.mt.wms.empty.vo.ApmsEndProcessVo;
+import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo;
+import com.mt.wms.empty.vo.ApmsStoveVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -21,6 +27,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
import java.util.HashMap;
/**
@@ -39,27 +47,31 @@ 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";
@PostMapping(value = "apmsPostOrder")
@ApiOperation(value = "接收APMS推送订单信息")
- public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
+ public R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("Wms接收Apms订单");
+ communicationLog.setLogName("WMS接收APMS订单");
communicationLog.setContent(apmsPostOrderParam.toString());
+ communicationLog.setType(3);
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
return orderInfoService.apmsPostOrder(apmsPostOrderParam);
}
@PostMapping(value = "apmsVoidOrder")
- @ApiOperation(value = "APMS作废订单")
- public R apmsVoidOrder(@Validated @RequestBody String idenCardNum) {
+ @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);
communicationLogServiceBiz.save(communicationLog);
@@ -67,99 +79,129 @@ public class ApmsController extends BaseController {
}
@PostMapping(value = "apmsCompleteOrder")
- @ApiOperation(value = "APMS完成订单")
- public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) {
+ @ApiOperation(value = "APMS完成订单,返回加工单检验结果")
+ public R apmsCompleteOrder(@Validated @RequestBody ApmsCompleteOrder apmsCompleteOrder) {
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("APMS完成订单");
+ communicationLog.setLogName("APMS完成订单,返回WMS加工单检验结果");
+ communicationLog.setType(3);
communicationLog.setContent(apmsCompleteOrder.toString());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
+ //APMS完成订单,返回检验结果,更新结果和后续处理
return orderInfoService.apmsCompleteOrder(apmsCompleteOrder);
}
- @PostMapping(value = "createProcessSheet")
- @ApiOperation(value = "APMS创建生产单接口")
- public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
+
+ /**
+ * 通过生产单编号删除生产单,如果生产单加工完成,不允许删除
+ *
+ * @param sheetNo 生产单编号
+ * @return 删除结果
+ */
+ @PostMapping(value = "deleteBySheetNo")
+ @ApiOperation(value = "通知APMS删除生产单")
+ public R deleteBySheetNo(@Validated @RequestBody String sheetNo) {
checkToken();
HashMap paramMap = new HashMap<>();
- paramMap.put("entity", apmsCreateProcess);
- HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet")
+ 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("APMS创建生产单");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS通知APMS删除生产单");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
- return successful(response);
+ return successful(JSONUtil.toBean(response.body(), ApmsEndProcessVo.class));
+ }
+
+ @PostMapping(value = "createProcessSheet")
+ @ApiOperation(value = "通知APMS创建生产单接口")
+ public R createProcessSheet(@Validated @RequestBody ApmsCreateProcessSheet apmsCreateProcess) {
+ checkToken();
+ String paramJson = JSONUtil.toJsonStr(apmsCreateProcess);
+ HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/createProcessSheet")
+ .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
+ CommunicationLog communicationLog = new CommunicationLog();
+ communicationLog.setCode("APMS" + System.currentTimeMillis());
+ communicationLog.setLogName("WMS通知APMS创建生产单");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
+ setCommonField(communicationLog);
+ communicationLogServiceBiz.save(communicationLog);
+ return successful(JSONUtil.toBean(response.body(), ApmsCreateProcessSheetVo.class));
}
@PostMapping(value = "startProcess")
@ApiOperation(value = "通知APMS生产单开始处理")
- public R startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) {
+ public R startProcess(@Validated @RequestBody ApmsStartProcess apmsStartProcess) {
checkToken();
- HashMap paramMap = new HashMap<>();
- paramMap.put("entity", apmsStartProcess);
+ String paramJson = JSONUtil.toJsonStr(apmsStartProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/startProcess")
- .header("token", Token).form(paramMap).execute();
+ .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("通知APMS生产单开始处理");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS通知APMS生产单开始处理");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
- return successful(response);
+ return successful(JSONUtil.toBean(response.body(), ApmsStartProcess.class));
}
@PostMapping(value = "endProcess")
- @ApiOperation(value = "通知APMS订单结束处理")
- public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
+ @ApiOperation(value = "通知APMS生产单结束处理")
+ public R endProcess(@Validated @RequestBody ApmsEndProcess apmsEndProcess) {
checkToken();
- HashMap paramMap = new HashMap<>();
- paramMap.put("entity", apmsEndProcess);
+ String paramJson = JSONUtil.toJsonStr(apmsEndProcess);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/endProcess")
- .header("token", Token).form(paramMap).execute();
+ .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("通知APMS订单结束处理");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS通知APMS生产单结束处理");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
- return successful(response);
+ return successful(JSONUtil.toBean(response.body(), ApmsEndProcessVo.class));
}
@PostMapping(value = "finishProcessSheet")
@ApiOperation(value = "通知APMS完成生产单接口")
- public R finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) {
+ public R finishProcessSheet(@Validated @RequestBody ApmsFinishProcessSheet apmsFinishProcessSheet) {
checkToken();
- HashMap paramMap = new HashMap<>();
- paramMap.put("entity", apmsFinishProcessSheet);
+ String paramJson = JSONUtil.toJsonStr(apmsFinishProcessSheet);
HttpResponse response = HttpUtil.createPost(ApiAddress + "/platform/api/finishProcessSheet")
- .header("token", Token).form(paramMap).execute();
+ .header("token", Token).body(paramJson, ContentType.JSON.toString()).execute();
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("通知APMS完成生产单接口");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS通知APMS完成生产单");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramJson + "\nresult:" + response.body());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
- return successful(response);
+ return successful(JSONUtil.toBean(response.body(), ApmsFinishProcessSheetVo.class));
}
@PostMapping(value = "getApmsToken")
@ApiOperation(value = "获取APMS Token")
- public R getApmsToken() {
+ public R getApmsToken() {
HashMap paramMap = new HashMap<>();
paramMap.put("apiKey", "7ee8f59bbaeae27e");
paramMap.put("platFormCode", "CUC");
String result = HttpUtil.get(ApiAddress + "/platform/api/getToken", paramMap);
JSON parse = JSONUtil.parse(result);
Object token = parse.getByPath("token");
+ String expireTime = parse.getByPath("expireTime").toString();
Token = token.toString();
+ TokenExpireTime = LocalDateTime.parse(expireTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("获取APMS Token");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS获取APMS Token");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramMap + "\nresult:" + result);
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
return successful(result);
@@ -167,7 +209,7 @@ public class ApmsController extends BaseController {
@PostMapping(value = "getStoveCodeByWorkShopCode")
@ApiOperation(value = "APMS通过车间编码获取炉号信息")
- public R getStoveCodeByWorkShopCode(String workShopCode) {
+ public R getStoveCodeByWorkShopCode(String workShopCode) {
checkToken();
HashMap paramMap = new HashMap<>();
paramMap.put("workShopCode", workShopCode);
@@ -175,11 +217,12 @@ public class ApmsController extends BaseController {
.header("token", Token).form(paramMap).execute();
CommunicationLog communicationLog = new CommunicationLog();
communicationLog.setCode("APMS" + System.currentTimeMillis());
- communicationLog.setLogName("APMS通过车间编码获取炉号信息");
- communicationLog.setContent(paramMap.toString());
+ communicationLog.setLogName("WMS通过APMS使用车间编码获取炉号信息");
+ communicationLog.setType(2);
+ communicationLog.setContent("param:" + paramMap + "\nresult:" + response.body());
setCommonField(communicationLog);
communicationLogServiceBiz.save(communicationLog);
- return successful(response);
+ return successful(JSONUtil.toBean(response.body(), ApmsStoveVo.class));
}
private void checkToken() {
@@ -187,5 +230,15 @@ public class ApmsController extends BaseController {
{
getApmsToken();
}
+ else if (TokenExpireTime.isBefore(LocalDateTime.now()))
+ {
+ getApmsToken();
+ }
+ }
+
+ private void setCommonField(CommunicationLog communicationLog) {
+ communicationLog.setValid(WhetherEnum.YES.getValue());
+ communicationLog.setCreateTime(LocalDateTime.now());
+ communicationLog.setUpdateTime(LocalDateTime.now());
}
}
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..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
@@ -1,15 +1,25 @@
package com.mt.wms.empty.controller;
+import com.mt.wms.basic.service.KilnInfoService;
+import com.mt.wms.basic.vo.KilnInfoVo;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
+import com.mt.wms.core.dal.entity.CurrTask;
+import com.mt.wms.core.params.BasePageParam;
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.params.ApmsCreateProcessSheet;
+import com.mt.wms.empty.params.CreateItem;
import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.CurrTaskService;
+import com.mt.wms.empty.service.OrderInfoService;
+import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
+import com.mt.wms.empty.vo.ApmsStoveVo;
+import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
import com.mt.wms.empty.vo.CurrTaskQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -21,6 +31,11 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Map;
+
/**
* @author xcc
* @date 2021年11月8日
@@ -35,25 +50,102 @@ public class CurrTaskController extends BaseController {
private CurrTaskService currTaskService;
@Autowired
private CurrTaskDetService currTaskDetService;
+ @Autowired
+ private OrderInfoService orderInfoService;
+ @Autowired
+ private ApmsController apmsControl;
+ @Autowired
+ private KilnInfoService kilnInfoService;
@PostMapping(value = "createProcessTask")
- @ApiOperation(value = "创建一个加工任务至任务队列")
- public R createProcessTask(@Validated @RequestBody TaskCreateParam param) {
- R mainTask = currTaskService.createProcessTask(param);
- currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
- return successful("创建成功。");
+ @ApiOperation(value = "订单加工-创建一个加工任务至任务队列")
+ public R createProcessTask(@Validated @RequestBody TaskCreateParam param) {
+ //验证标识卡号正确无误。
+ orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
+ //验证炉子编码信息在apms正确无误
+ R kilnInfoVoR = kilnInfoService.get(IdParam.builder().id(param.getKilnId()).build());
+ String kilnCode = kilnInfoVoR.getData().getCode();
+ R bm = apmsControl.getStoveCodeByWorkShopCode("BM");
+ ArrayList