From 4a8237cf2171d39cc144ffdd5418bf38bfb5664f Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期五, 14 六月 2024 18:36:52 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java | 2
src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java | 36 +
src/main/java/com/zy/asrs/entity/SingleMountUnstackingCompleteParam.java | 77 +++
src/main/java/com/zy/asrs/task/core/WcsDispatcher.java | 59 ++
src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java | 5
src/main/java/com/zy/asrs/service/impl/WrkDetlSingleServiceImpl.java | 12
src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java | 269 ++++++++++
src/main/java/com/zy/common/CodeBuilder.java | 4
src/main/java/com/zy/asrs/entity/WrkDetlSingle.java | 469 ++++++++++++++++++
src/main/java/com/zy/asrs/entity/ApiLog.java | 194 +++++++
src/main/java/com/zy/asrs/service/WrkDetlSingleService.java | 8
src/main/resources/mapper/WrkDetlMapper.xml | 4
src/main/resources/mapper/WrkDetlSingleMapper.xml | 50 ++
src/main/java/com/zy/asrs/service/impl/ApiLogServiceImpl.java | 52 ++
src/main/java/com/zy/asrs/task/AbstractHandler.java | 30 +
src/main/java/com/zy/asrs/task/core/ReturnT.java | 65 ++
src/main/java/com/zy/common/utils/Synchro.java | 38 +
src/main/java/com/zy/asrs/mapper/ApiLogMapper.java | 12
src/main/java/com/zy/asrs/service/ApiLogService.java | 10
src/main/resources/mapper/ApiLogMapper.xml | 32 +
src/main/java/com/zy/asrs/task/core/AsrsException.java | 16
src/main/java/com/zy/asrs/mapper/WrkDetlSingleMapper.java | 12
src/main/resources/application.yml | 10
src/main/java/com/zy/asrs/service/WrkDetlService.java | 2
24 files changed, 1,461 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/zy/asrs/entity/ApiLog.java b/src/main/java/com/zy/asrs/entity/ApiLog.java
new file mode 100644
index 0000000..78fa188
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/ApiLog.java
@@ -0,0 +1,194 @@
+package com.zy.asrs.entity;
+
+import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.enums.IdType;
+import com.baomidou.mybatisplus.annotations.TableField;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.io.Serializable;
+
+@Data
+@TableName("man_api_log")
+public class ApiLog implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ID
+ */
+ @ApiModelProperty(value= "ID")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 鏃ュ織缂栧彿
+ */
+ @ApiModelProperty(value= "鏃ュ織缂栧彿")
+ private String uuid;
+
+ /**
+ * 鍚嶇О绌洪棿
+ */
+ @ApiModelProperty(value= "鍚嶇О绌洪棿")
+ private String namespace;
+
+ /**
+ * 鎺ュ彛鍦板潃
+ */
+ @ApiModelProperty(value= "鎺ュ彛鍦板潃")
+ private String url;
+
+ /**
+ * 骞冲彴瀵嗛挜
+ */
+ @ApiModelProperty(value= "骞冲彴瀵嗛挜")
+ private String appkey;
+
+ /**
+ * 鏃堕棿鎴�
+ */
+ @ApiModelProperty(value= "鏃堕棿鎴�")
+ private String timestamp;
+
+ /**
+ * 瀹㈡埛绔疘P
+ */
+ @ApiModelProperty(value= "瀹㈡埛绔疘P")
+ @TableField("client_ip")
+ private String clientIp;
+
+ /**
+ * 璇锋眰鍐呭
+ */
+ @ApiModelProperty(value= "璇锋眰鍐呭")
+ private String request;
+
+ /**
+ * 鍝嶅簲鍐呭
+ */
+ @ApiModelProperty(value= "鍝嶅簲鍐呭")
+ private String response;
+
+ /**
+ * 寮傚父鍐呭
+ */
+ @ApiModelProperty(value= "寮傚父鍐呭")
+ private String err;
+
+ /**
+ * 缁撴灉 1: 鎴愬姛 0: 澶辫触
+ */
+ @ApiModelProperty(value= "缁撴灉 1: 鎴愬姛 0: 澶辫触 ")
+ private Integer result;
+
+ /**
+ * 鐘舵�� 1: 姝e父 0: 绂佺敤
+ */
+ @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 绂佺敤 ")
+ private Integer status;
+
+ /**
+ * 娣诲姞鏃堕棿
+ */
+ @ApiModelProperty(value= "娣诲姞鏃堕棿")
+ @TableField("create_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty(value= "淇敼鏃堕棿")
+ @TableField("update_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date updateTime;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty(value= "澶囨敞")
+ private String memo;
+
+ public ApiLog() {}
+
+ public ApiLog(String uuid,String namespace,String url,String appkey,String timestamp,String clientIp,String request,String response,String err,Integer result,Integer status,Date createTime,Date updateTime,String memo) {
+ this.uuid = uuid;
+ this.namespace = namespace;
+ this.url = url;
+ this.appkey = appkey;
+ this.timestamp = timestamp;
+ this.clientIp = clientIp;
+ this.request = request;
+ this.response = response;
+ this.err = err;
+ this.result = result;
+ this.status = status;
+ this.createTime = createTime;
+ this.updateTime = updateTime;
+ this.memo = memo;
+ }
+
+// ApiLog apiLog = new ApiLog(
+// null, // 鏃ュ織缂栧彿
+// null, // 鍚嶇О绌洪棿
+// null, // 鎺ュ彛鍦板潃
+// null, // 骞冲彴瀵嗛挜
+// null, // 鏃堕棿鎴�
+// null, // 瀹㈡埛绔疘P
+// null, // 璇锋眰鍐呭
+// null, // 鍝嶅簲鍐呭
+// null, // 寮傚父鍐呭
+// null, // 缁撴灉
+// null, // 鐘舵��
+// null, // 娣诲姞鏃堕棿
+// null, // 淇敼鏃堕棿
+// null // 澶囨敞
+// );
+
+ public String getResult$(){
+ if (null == this.result){ return null; }
+ switch (this.result){
+ case 1:
+ return "鎴愬姛";
+ case 0:
+ return "澶辫触";
+ default:
+ return String.valueOf(this.result);
+ }
+ }
+
+ public String getStatus$(){
+ if (null == this.status){ return null; }
+ switch (this.status){
+ case 1:
+ return "姝e父";
+ case 0:
+ return "绂佺敤";
+ default:
+ return String.valueOf(this.status);
+ }
+ }
+
+ public String getCreateTime$(){
+ if (Cools.isEmpty(this.createTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime);
+ }
+
+ public String getUpdateTime$(){
+ if (Cools.isEmpty(this.updateTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime);
+ }
+
+
+}
diff --git a/src/main/java/com/zy/asrs/entity/SingleMountUnstackingCompleteParam.java b/src/main/java/com/zy/asrs/entity/SingleMountUnstackingCompleteParam.java
new file mode 100644
index 0000000..c54685b
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/SingleMountUnstackingCompleteParam.java
@@ -0,0 +1,77 @@
+package com.zy.asrs.entity;
+
+import lombok.Data;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/*
+ * Created by Monkey D. Luffy on 2023.07.19
+ * */
+@Data
+public class SingleMountUnstackingCompleteParam {
+ private String barcode;// 鏄� 瀛楃涓� 鎵樼洏鐮�
+ private String boxType;// 鏄� 瀛楃涓� 鐮佸灈鏈ㄧ绫诲瀷锛堝悓涓�鎵樼洏涓�绉嶇被鍨嬶級
+ private String palletizingNo;// 鏄� 瀛楃涓� 鐮佸灈鏈ㄧ绫诲瀷锛堝悓涓�鎵樼洏涓�绉嶇被鍨嬶級 搴熷純
+ private String createTime;// 鏄� 瀛楃涓� 鍒涘缓鏃堕棿
+ private String uuid;// 鏄� 瀛楃涓� 鏃堕棿鎴�
+ private Integer staStart;// 鏄� 瀛楃涓� 璧峰绔欑偣锛堟墭鐩樻墍鍦ㄧ珯鐐癸級
+ private Integer staEnd;// 鏄� 瀛楃涓� 鐩爣绔欑偣锛堟媶鍨涚洰鐨勭珯鐐癸級
+ private List<MatList> matList;// 鏄� 鍒楄〃 鎷嗗灈鍓╀綑璐х墿淇℃伅(鍙互涓虹┖)
+
+ @Data
+ public static class MatList{
+ private String position;// 鏄� 瀛楃涓� 鏈ㄧ鐮佸灈浣嶇疆
+ private boolean unstackingEnd;// 灏剧鏍囪瘑锛堟渶鍚庝竴鎵樹负true锛屽叾浠栦负false锛�
+ private String boxNo;// 鏄� 瀛楃涓� 鏈ㄧ缂栧彿锛堝敮涓�瀛楁锛屽嚭搴撲緷鎹紝鍑哄簱鏃舵寜鐓ф湪绠辩紪鍙峰嚭搴擄級
+ }
+
+ public SingleMountUnstackingCompleteParam(){}
+
+ public SingleMountUnstackingCompleteParam(WrkMast wrkMast, List<WrkDetl> wrkDetlList){
+ Date now = new Date();
+ this.barcode=wrkMast.getBarcode();
+ this.boxType=wrkDetlList.get(0).getBrand();
+ createTime=now.toString();
+ uuid=String.valueOf(now.getTime());
+ List<MatList> matLists=new ArrayList<>();
+ if (wrkMast.getStaNo()==118 || wrkMast.getStaNo()==120){
+ for (WrkDetl wrkDetl:wrkDetlList){
+ if (wrkDetl.getOrigin().equals("1")) continue;
+ MatList matList = new MatList();
+ matList.setBoxNo(wrkDetl.getBatch());
+ matList.setPosition(wrkDetl.getOrigin());
+ matList.setUnstackingEnd(false);
+ matLists.add(matList);
+ }
+ for (WrkDetl wrkDetl:wrkDetlList){
+ if (wrkDetl.getOrigin().equals("2")) continue;
+ MatList matList = new MatList();
+ matList.setBoxNo(wrkDetl.getBatch());
+ matList.setPosition(wrkDetl.getOrigin());
+ matList.setUnstackingEnd(false);
+ matLists.add(matList);
+ }
+ }else {
+ for (WrkDetl wrkDetl:wrkDetlList){
+ if (wrkDetl.getOrigin().equals("2")) continue;
+ MatList matList = new MatList();
+ matList.setBoxNo(wrkDetl.getBatch());
+ matList.setPosition(wrkDetl.getOrigin());
+ matList.setUnstackingEnd(false);
+ matLists.add(matList);
+ }
+ for (WrkDetl wrkDetl:wrkDetlList){
+ if (wrkDetl.getOrigin().equals("1")) continue;
+ MatList matList = new MatList();
+ matList.setBoxNo(wrkDetl.getBatch());
+ matList.setPosition(wrkDetl.getOrigin());
+ matList.setUnstackingEnd(false);
+ matLists.add(matList);
+ }
+ }
+
+ this.matList = matLists;
+ }
+}
diff --git a/src/main/java/com/zy/asrs/entity/WrkDetlSingle.java b/src/main/java/com/zy/asrs/entity/WrkDetlSingle.java
new file mode 100644
index 0000000..be820ec
--- /dev/null
+++ b/src/main/java/com/zy/asrs/entity/WrkDetlSingle.java
@@ -0,0 +1,469 @@
+package com.zy.asrs.entity;
+
+import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableField;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import com.zy.common.utils.Synchro;
+import org.springframework.format.annotation.DateTimeFormat;
+import com.core.common.SpringUtils;
+import com.zy.system.service.UserService;
+import com.zy.system.entity.User;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import com.core.common.SpringUtils;
+import com.zy.system.service.UserService;
+import com.zy.system.entity.User;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import com.baomidou.mybatisplus.annotations.TableName;
+import java.io.Serializable;
+
+@Data
+@TableName("asr_wrk_detl_single")
+public class WrkDetlSingle implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 宸ヤ綔鍙�
+ */
+ @ApiModelProperty(value= "宸ヤ綔鍙�")
+ @TableField("wrk_no")
+ private Long wrkNo;
+
+ /**
+ * 宸ヤ綔鏃堕棿
+ */
+ @ApiModelProperty(value= "宸ヤ綔鏃堕棿")
+ @TableField("io_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date ioTime;
+
+ /**
+ * 鏁伴噺
+ */
+ @ApiModelProperty(value= "鏁伴噺")
+ private Double anfme;
+
+ /**
+ * 鎵樼洏鏉$爜
+ */
+ @ApiModelProperty(value= "鎵樼洏鏉$爜")
+ private String zpallet;
+
+ /**
+ * 鍟嗗搧缂栧彿
+ */
+ @ApiModelProperty(value= "鍟嗗搧缂栧彿")
+ private String matnr;
+
+ /**
+ * 鍟嗗搧鍚嶇О
+ */
+ @ApiModelProperty(value= "鍟嗗搧鍚嶇О")
+ private String maktx;
+
+ /**
+ * 鎵瑰彿
+ */
+ @ApiModelProperty(value= "鎵瑰彿")
+ private String batch;
+
+ /**
+ * 鍗曟嵁缂栧彿
+ */
+ @ApiModelProperty(value= "鍗曟嵁缂栧彿")
+ @TableField("order_no")
+ private String orderNo;
+
+ /**
+ * 瑙勬牸
+ */
+ @ApiModelProperty(value= "瑙勬牸")
+ private String specs;
+
+ /**
+ * 鍨嬪彿
+ */
+ @ApiModelProperty(value= "鍨嬪彿")
+ private String model;
+
+ /**
+ * 棰滆壊
+ */
+ @ApiModelProperty(value= "棰滆壊")
+ private String color;
+
+ /**
+ * 鍝佺墝
+ */
+ @ApiModelProperty(value= "鍝佺墝")
+ private String brand;
+
+ /**
+ * 鍗曚綅
+ */
+ @ApiModelProperty(value= "鍗曚綅")
+ private String unit;
+
+ /**
+ * 鍗曚环
+ */
+ @ApiModelProperty(value= "鍗曚环")
+ private Double price;
+
+ /**
+ * sku
+ */
+ @ApiModelProperty(value= "sku")
+ private String sku;
+
+ /**
+ * 鍗曚綅閲�
+ */
+ @ApiModelProperty(value= "鍗曚綅閲�")
+ private Double units;
+
+ /**
+ * 鏉$爜
+ */
+ @ApiModelProperty(value= "鏉$爜")
+ private String barcode;
+
+ /**
+ * 浜у湴
+ */
+ @ApiModelProperty(value= "浜у湴")
+ private String origin;
+
+ /**
+ * 鍘傚
+ */
+ @ApiModelProperty(value= "鍘傚")
+ private String manu;
+
+ /**
+ * 鐢熶骇鏃ユ湡
+ */
+ @ApiModelProperty(value= "鐢熶骇鏃ユ湡")
+ @TableField("manu_date")
+ private String manuDate;
+
+ /**
+ * 鍝侀」鏁�
+ */
+ @ApiModelProperty(value= "鍝侀」鏁�")
+ @TableField("item_num")
+ private String itemNum;
+
+ /**
+ * 瀹夊叏搴撳瓨閲�
+ */
+ @ApiModelProperty(value= "瀹夊叏搴撳瓨閲�")
+ @TableField("safe_qty")
+ private Double safeQty;
+
+ /**
+ * 閲嶉噺
+ */
+ @ApiModelProperty(value= "閲嶉噺")
+ private Double weight;
+
+ /**
+ * 闀垮害
+ */
+ @ApiModelProperty(value= "闀垮害")
+ private Double length;
+
+ /**
+ * 浣撶Н
+ */
+ @ApiModelProperty(value= "浣撶Н")
+ private Double volume;
+
+ /**
+ * 涓夋柟缂栫爜
+ */
+ @ApiModelProperty(value= "涓夋柟缂栫爜")
+ @TableField("three_code")
+ private String threeCode;
+
+ /**
+ * 渚涘簲鍟�
+ */
+ @ApiModelProperty(value= "渚涘簲鍟�")
+ private String supp;
+
+ /**
+ * 渚涘簲鍟嗙紪鐮�
+ */
+ @ApiModelProperty(value= "渚涘簲鍟嗙紪鐮�")
+ @TableField("supp_code")
+ private String suppCode;
+
+ /**
+ * 鏄惁鎵规 1: 鏄� 0: 鍚�
+ */
+ @ApiModelProperty(value= "鏄惁鎵规 1: 鏄� 0: 鍚� ")
+ @TableField("be_batch")
+ private Integer beBatch;
+
+ /**
+ * 淇濊川鏈�
+ */
+ @ApiModelProperty(value= "淇濊川鏈�")
+ @TableField("dead_time")
+ private String deadTime;
+
+ /**
+ * 棰勮澶╂暟
+ */
+ @ApiModelProperty(value= "棰勮澶╂暟")
+ @TableField("dead_warn")
+ private Integer deadWarn;
+
+ /**
+ * 鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗
+ */
+ @ApiModelProperty(value= "鍒惰喘 1: 鍒堕�� 2: 閲囪喘 3: 澶栧崗 ")
+ private Integer source;
+
+ /**
+ * 瑕佹眰妫�楠� 1: 鏄� 0: 鍚�
+ */
+ @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄� 0: 鍚� ")
+ private Integer inspect;
+
+ /**
+ * 鍗遍櫓鍝� 1: 鏄� 0: 鍚�
+ */
+ @ApiModelProperty(value= "鍗遍櫓鍝� 1: 鏄� 0: 鍚� ")
+ private Integer danger;
+
+ /**
+ * 淇敼浜哄憳
+ */
+ @ApiModelProperty(value= "淇敼浜哄憳")
+ @TableField("modi_user")
+ private Long modiUser;
+
+ /**
+ * 淇敼鏃堕棿
+ */
+ @ApiModelProperty(value= "淇敼鏃堕棿")
+ @TableField("modi_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date modiTime;
+
+ /**
+ * 娣诲姞浜哄憳
+ */
+ @ApiModelProperty(value= "娣诲姞浜哄憳")
+ @TableField("appe_user")
+ private Long appeUser;
+
+ /**
+ * 娣诲姞鏃堕棿
+ */
+ @ApiModelProperty(value= "娣诲姞鏃堕棿")
+ @TableField("appe_time")
+ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+ private Date appeTime;
+
+ /**
+ * 澶囨敞
+ */
+ @ApiModelProperty(value= "澶囨敞")
+ private String memo;
+
+ @ApiModelProperty(value= "")
+ @TableField("roll_up")
+ private Long rollUp;
+
+ public WrkDetlSingle() {}
+
+ public WrkDetlSingle(Long wrkNo,Date ioTime,Double anfme,String zpallet,String matnr,String maktx,String batch,String orderNo,String specs,String model,String color,String brand,String unit,Double price,String sku,Double units,String barcode,String origin,String manu,String manuDate,String itemNum,Double safeQty,Double weight,Double length,Double volume,String threeCode,String supp,String suppCode,Integer beBatch,String deadTime,Integer deadWarn,Integer source,Integer inspect,Integer danger,Long modiUser,Date modiTime,Long appeUser,Date appeTime,String memo,Long rollUp) {
+ this.wrkNo = wrkNo;
+ this.ioTime = ioTime;
+ this.anfme = anfme;
+ this.zpallet = zpallet;
+ this.matnr = matnr;
+ this.maktx = maktx;
+ this.batch = batch;
+ this.orderNo = orderNo;
+ this.specs = specs;
+ this.model = model;
+ this.color = color;
+ this.brand = brand;
+ this.unit = unit;
+ this.price = price;
+ this.sku = sku;
+ this.units = units;
+ this.barcode = barcode;
+ this.origin = origin;
+ this.manu = manu;
+ this.manuDate = manuDate;
+ this.itemNum = itemNum;
+ this.safeQty = safeQty;
+ this.weight = weight;
+ this.length = length;
+ this.volume = volume;
+ this.threeCode = threeCode;
+ this.supp = supp;
+ this.suppCode = suppCode;
+ this.beBatch = beBatch;
+ this.deadTime = deadTime;
+ this.deadWarn = deadWarn;
+ this.source = source;
+ this.inspect = inspect;
+ this.danger = danger;
+ this.modiUser = modiUser;
+ this.modiTime = modiTime;
+ this.appeUser = appeUser;
+ this.appeTime = appeTime;
+ this.memo = memo;
+ this.rollUp = rollUp;
+ }
+
+// WrkDetlSingle wrkDetlSingle = new WrkDetlSingle(
+// null, // 宸ヤ綔鍙穂闈炵┖]
+// null, // 宸ヤ綔鏃堕棿
+// null, // 鏁伴噺
+// null, // 鎵樼洏鏉$爜
+// null, // 鍟嗗搧缂栧彿[闈炵┖]
+// null, // 鍟嗗搧鍚嶇О
+// null, // 鎵瑰彿
+// null, // 鍗曟嵁缂栧彿
+// null, // 瑙勬牸
+// null, // 鍨嬪彿
+// null, // 棰滆壊
+// null, // 鍝佺墝
+// null, // 鍗曚綅
+// null, // 鍗曚环
+// null, // sku
+// null, // 鍗曚綅閲�
+// null, // 鏉$爜
+// null, // 浜у湴
+// null, // 鍘傚
+// null, // 鐢熶骇鏃ユ湡
+// null, // 鍝侀」鏁�
+// null, // 瀹夊叏搴撳瓨閲�
+// null, // 閲嶉噺
+// null, // 闀垮害
+// null, // 浣撶Н
+// null, // 涓夋柟缂栫爜
+// null, // 渚涘簲鍟�
+// null, // 渚涘簲鍟嗙紪鐮�
+// null, // 鏄惁鎵规
+// null, // 淇濊川鏈�
+// null, // 棰勮澶╂暟
+// null, // 鍒惰喘
+// null, // 瑕佹眰妫�楠�
+// null, // 鍗遍櫓鍝�
+// null, // 淇敼浜哄憳
+// null, // 淇敼鏃堕棿
+// null, // 娣诲姞浜哄憳
+// null, // 娣诲姞鏃堕棿
+// null, // 澶囨敞
+// null //
+// );
+
+ public String getIoTime$(){
+ if (Cools.isEmpty(this.ioTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.ioTime);
+ }
+
+ public String getBeBatch$(){
+ if (null == this.beBatch){ return null; }
+ switch (this.beBatch){
+ case 1:
+ return "鏄�";
+ case 0:
+ return "鍚�";
+ default:
+ return String.valueOf(this.beBatch);
+ }
+ }
+
+ public String getSource$(){
+ if (null == this.source){ return null; }
+ switch (this.source){
+ case 1:
+ return "鍒堕��";
+ case 2:
+ return "閲囪喘";
+ case 3:
+ return "澶栧崗";
+ default:
+ return String.valueOf(this.source);
+ }
+ }
+
+ public String getInspect$(){
+ if (null == this.inspect){ return null; }
+ switch (this.inspect){
+ case 1:
+ return "鏄�";
+ case 0:
+ return "鍚�";
+ default:
+ return String.valueOf(this.inspect);
+ }
+ }
+
+ public String getDanger$(){
+ if (null == this.danger){ return null; }
+ switch (this.danger){
+ case 1:
+ return "鏄�";
+ case 0:
+ return "鍚�";
+ default:
+ return String.valueOf(this.danger);
+ }
+ }
+
+ public String getModiUser$(){
+ UserService service = SpringUtils.getBean(UserService.class);
+ User user = service.selectById(this.modiUser);
+ if (!Cools.isEmpty(user)){
+ return String.valueOf(user.getUsername());
+ }
+ return null;
+ }
+
+ public String getModiTime$(){
+ if (Cools.isEmpty(this.modiTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime);
+ }
+
+ public String getAppeUser$(){
+ UserService service = SpringUtils.getBean(UserService.class);
+ User user = service.selectById(this.appeUser);
+ if (!Cools.isEmpty(user)){
+ return String.valueOf(user.getUsername());
+ }
+ return null;
+ }
+
+ public String getAppeTime$(){
+ if (Cools.isEmpty(this.appeTime)){
+ return "";
+ }
+ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.appeTime);
+ }
+
+ public void sync(Object source) {
+ Synchro.Copy(source, this);
+ }
+
+
+}
diff --git a/src/main/java/com/zy/asrs/mapper/ApiLogMapper.java b/src/main/java/com/zy/asrs/mapper/ApiLogMapper.java
new file mode 100644
index 0000000..48eed1b
--- /dev/null
+++ b/src/main/java/com/zy/asrs/mapper/ApiLogMapper.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.mapper;
+
+import com.zy.asrs.entity.ApiLog;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface ApiLogMapper extends BaseMapper<ApiLog> {
+ int clearWeekBefore();
+}
diff --git a/src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java b/src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java
index 3ff2711..f953518 100644
--- a/src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java
+++ b/src/main/java/com/zy/asrs/mapper/WrkDetlMapper.java
@@ -17,4 +17,6 @@
int updateIoTime(@Param("workNo") Integer workNo, @Param("ioTime") Date ioTime);
+ List<WrkDetl> selectByWrkNo(Integer wrkNo);
+
}
diff --git a/src/main/java/com/zy/asrs/mapper/WrkDetlSingleMapper.java b/src/main/java/com/zy/asrs/mapper/WrkDetlSingleMapper.java
new file mode 100644
index 0000000..d37081c
--- /dev/null
+++ b/src/main/java/com/zy/asrs/mapper/WrkDetlSingleMapper.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.mapper;
+
+import com.zy.asrs.entity.WrkDetlSingle;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface WrkDetlSingleMapper extends BaseMapper<WrkDetlSingle> {
+
+}
diff --git a/src/main/java/com/zy/asrs/service/ApiLogService.java b/src/main/java/com/zy/asrs/service/ApiLogService.java
new file mode 100644
index 0000000..0221f72
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/ApiLogService.java
@@ -0,0 +1,10 @@
+package com.zy.asrs.service;
+
+import com.zy.asrs.entity.ApiLog;
+import com.baomidou.mybatisplus.service.IService;
+
+public interface ApiLogService extends IService<ApiLog> {
+ void save(String namespace, String url, String appkey, String ip, String request, String response, boolean success);
+
+ boolean clearWeekBefore();
+}
diff --git a/src/main/java/com/zy/asrs/service/WrkDetlService.java b/src/main/java/com/zy/asrs/service/WrkDetlService.java
index 18f7637..81d4e92 100644
--- a/src/main/java/com/zy/asrs/service/WrkDetlService.java
+++ b/src/main/java/com/zy/asrs/service/WrkDetlService.java
@@ -15,4 +15,6 @@
boolean updateIoTime(Integer workNo, Date ioTime);
+ List<WrkDetl> selectByWrkNo(Integer wrkNo);
+
}
diff --git a/src/main/java/com/zy/asrs/service/WrkDetlSingleService.java b/src/main/java/com/zy/asrs/service/WrkDetlSingleService.java
new file mode 100644
index 0000000..d89cd43
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/WrkDetlSingleService.java
@@ -0,0 +1,8 @@
+package com.zy.asrs.service;
+
+import com.zy.asrs.entity.WrkDetlSingle;
+import com.baomidou.mybatisplus.service.IService;
+
+public interface WrkDetlSingleService extends IService<WrkDetlSingle> {
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/ApiLogServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/ApiLogServiceImpl.java
new file mode 100644
index 0000000..71bd311
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/ApiLogServiceImpl.java
@@ -0,0 +1,52 @@
+package com.zy.asrs.service.impl;
+
+import com.core.common.SnowflakeIdWorker;
+import com.zy.asrs.mapper.ApiLogMapper;
+import com.zy.asrs.entity.ApiLog;
+import com.zy.asrs.service.ApiLogService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+@Slf4j
+@Service("apiLogService")
+public class ApiLogServiceImpl extends ServiceImpl<ApiLogMapper, ApiLog> implements ApiLogService {
+
+ @Autowired
+ private SnowflakeIdWorker snowflakeIdWorker;
+
+ @Async
+ @Override
+ public void save(String namespace, String url, String appkey, String ip, String request, String response, boolean success) {
+ Date now = new Date();
+ ApiLog apiLog = new ApiLog(
+ String.valueOf(snowflakeIdWorker.nextId()), // 鏃ュ織缂栧彿
+ namespace, // 鍚嶇О绌洪棿
+ url, // 鎺ュ彛鍦板潃
+ appkey, // 骞冲彴瀵嗛挜
+ String.valueOf(now.getTime()), // 鏃堕棿鎴�
+ ip, // 瀹㈡埛绔疘P
+ request, // 璇锋眰鍐呭
+ response,
+ null, // 寮傚父鍐呭
+ success?1:0 , // 缁撴灉
+ 1, // 鐘舵��
+ now, // 娣诲姞鏃堕棿
+ null, // 淇敼鏃堕棿
+ null // 澶囨敞
+ );
+ if (!this.insert(apiLog)) {
+ log.error("鎺ュ彛璋冪敤鏃ュ織淇濆瓨澶辫触锛�");
+ }
+ }
+
+ @Override
+ public boolean clearWeekBefore() {
+ return this.baseMapper.clearWeekBefore() > 0;
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java
index 017911a..ed33bd9 100644
--- a/src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WrkDetlServiceImpl.java
@@ -58,4 +58,9 @@
return this.baseMapper.updateIoTime(workNo, ioTime) > 0;
}
+ @Override
+ public List<WrkDetl> selectByWrkNo(Integer wrkNo) {
+ return this.baseMapper.selectByWrkNo(wrkNo);
+ }
+
}
diff --git a/src/main/java/com/zy/asrs/service/impl/WrkDetlSingleServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WrkDetlSingleServiceImpl.java
new file mode 100644
index 0000000..e91fddf
--- /dev/null
+++ b/src/main/java/com/zy/asrs/service/impl/WrkDetlSingleServiceImpl.java
@@ -0,0 +1,12 @@
+package com.zy.asrs.service.impl;
+
+import com.zy.asrs.mapper.WrkDetlSingleMapper;
+import com.zy.asrs.entity.WrkDetlSingle;
+import com.zy.asrs.service.WrkDetlSingleService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+@Service("wrkDetlSingleService")
+public class WrkDetlSingleServiceImpl extends ServiceImpl<WrkDetlSingleMapper, WrkDetlSingle> implements WrkDetlSingleService {
+
+}
diff --git a/src/main/java/com/zy/asrs/task/AbstractHandler.java b/src/main/java/com/zy/asrs/task/AbstractHandler.java
new file mode 100644
index 0000000..b48df43
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/AbstractHandler.java
@@ -0,0 +1,30 @@
+package com.zy.asrs.task;
+
+import com.core.exception.CoolException;
+import com.zy.asrs.task.core.ReturnT;
+import lombok.extern.slf4j.Slf4j;
+
+import java.text.MessageFormat;
+
+/**
+ * Created by vincent on 2020/7/4
+ */
+@Slf4j
+public abstract class AbstractHandler<T> {
+
+ public final ReturnT<T> SUCCESS = new ReturnT<>(200, null);
+ public final ReturnT<T> FAIL = new ReturnT<>(500, null);
+
+// protected abstract ReturnT<T> start();
+
+ protected void exceptionHandle(String errorMsg){
+ log.error(errorMsg);
+ exceptionHandle(errorMsg, (Object) null);
+ }
+
+ protected void exceptionHandle(String errorMsg, Object... args){
+ log.error(errorMsg);
+ throw new CoolException(MessageFormat.format(errorMsg, args));
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java b/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java
new file mode 100644
index 0000000..fe2980f
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/ReportToDismantleTheStackScheduler.java
@@ -0,0 +1,36 @@
+package com.zy.asrs.task;
+
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.asrs.task.handler.ReportToDismantleTheStackHandler;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * Created by Monkey D. Luffy on 2023.07.25
+ * 寰愬伐姹変簯..............浠ヤ笅.............涓婇ザ姹熼摐.............鎷嗗灈淇℃伅涓婁紶
+ */
+@Slf4j
+@Component
+public class ReportToDismantleTheStackScheduler {
+
+ @Autowired
+ private ReportToDismantleTheStackHandler reportToDismantleTheStackHandler;
+
+ @Scheduled(cron = "0/3 * * * * ? ")
+ private void execute(){//鎷嗗灈淇℃伅涓婁紶
+ int[] staNos =new int[]{118,119,120,121};
+ for (int staNo : staNos){
+ try{
+ ReturnT<String> result = reportToDismantleTheStackHandler.start(staNo);
+ if (result.getCode()==200){
+ break;
+ }
+ }catch (Exception e){
+ log.error("绔欑偣"+staNo+"鎷嗗灈淇℃伅涓婁紶澶勭悊澶辫触锛屽紓甯镐俊鎭細"+e);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/task/core/AsrsException.java b/src/main/java/com/zy/asrs/task/core/AsrsException.java
new file mode 100644
index 0000000..7c0d744
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/core/AsrsException.java
@@ -0,0 +1,16 @@
+package com.zy.asrs.task.core;
+
+/**
+ * Created by vincent on 2020/7/7
+ */
+public class AsrsException extends RuntimeException {
+
+ public AsrsException(Throwable e) {
+ super(e);
+ }
+
+ public AsrsException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/task/core/ReturnT.java b/src/main/java/com/zy/asrs/task/core/ReturnT.java
new file mode 100644
index 0000000..26b8c12
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/core/ReturnT.java
@@ -0,0 +1,65 @@
+package com.zy.asrs.task.core;
+
+import java.io.Serializable;
+
+/**
+ * Created by vincent on 2020/7/7
+ */
+public class ReturnT<T> implements Serializable {
+
+ public static final long serialVersionUID = 42L;
+ public static final int SUCCESS_CODE = 200;
+ public static final int FAIL_CODE = 500;
+ private int code;
+ private String msg;
+ private T content;
+
+ public ReturnT() {
+ }
+
+ public ReturnT(int code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ public ReturnT(T content) {
+ this.code = 200;
+ this.content = content;
+ }
+
+ public boolean isSuccess(){
+ return this.code == 200;
+ }
+
+ public int getCode() {
+ return this.code;
+ }
+
+ public ReturnT<T> setCode(int code) {
+ this.code = code;
+ return this;
+ }
+
+ public String getMsg() {
+ return this.msg;
+ }
+
+ public ReturnT<T> setMsg(String msg) {
+ this.msg = msg;
+ return this;
+ }
+
+ public T getContent() {
+ return this.content;
+ }
+
+ public ReturnT<T> setContent(T content) {
+ this.content = content;
+ return this;
+ }
+
+ public String toString() {
+ return "ReturnT [code=" + this.code + ", msg=" + this.msg + ", content=" + this.content + "]";
+ }
+
+}
diff --git a/src/main/java/com/zy/asrs/task/core/WcsDispatcher.java b/src/main/java/com/zy/asrs/task/core/WcsDispatcher.java
new file mode 100644
index 0000000..99aa2ea
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/core/WcsDispatcher.java
@@ -0,0 +1,59 @@
+//package com.zy.asrs.task.core;
+//
+//import com.zy.asrs.task.handler.WorkLogHandler;
+//import com.zy.asrs.task.handler.WorkMastHandler;
+//import com.zy.system.service.ConfigService;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.beans.factory.annotation.Autowired;
+//
+//import javax.annotation.PostConstruct;
+//import javax.annotation.PreDestroy;
+//
+///**
+// * 鍗曠嚎绋嬫ā寮� 锛� 宸插純鐢� )
+// * 浠诲姟涓績璋冨害鍣�
+// * Created by vincent on 2020/7/4
+// */
+////@Component
+//@Deprecated
+//public class WcsDispatcher {
+//
+// private static final Logger log = LoggerFactory.getLogger(WcsDispatcher.class);
+// private Thread thread;
+//
+// @Autowired
+// private WorkMastHandler workMastHandler;
+// @Autowired
+// private WorkLogHandler workLogHandler;
+// @Autowired
+// private ConfigService configService;
+//
+// @PostConstruct
+// private void start(){
+// thread = new Thread(() -> {
+// while (!Thread.currentThread().isInterrupted()) {
+// try {
+// Thread.sleep(3000);
+//
+//// workMastHandler.start();
+////
+//// workLogHandler.start();
+//
+// } catch (Exception e) {
+// log.error("Exception", e);
+// }
+// }
+// });
+// thread.start();
+// log.info("浠诲姟涓績璋冨害鍣ㄥ凡鍚姩......");
+// }
+//
+// @PreDestroy
+// public void shutDown(){
+// if (thread != null)
+// thread.interrupt();
+// log.info("浠诲姟涓績璋冨害鍣ㄥ凡鍋滄......");
+// }
+//
+//}
diff --git a/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java b/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java
new file mode 100644
index 0000000..db0c81a
--- /dev/null
+++ b/src/main/java/com/zy/asrs/task/handler/ReportToDismantleTheStackHandler.java
@@ -0,0 +1,269 @@
+package com.zy.asrs.task.handler;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.core.common.Cools;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.*;
+import com.zy.asrs.service.*;
+import com.zy.asrs.task.AbstractHandler;
+import com.zy.asrs.task.core.ReturnT;
+import com.zy.common.utils.HttpHandler;
+import com.zy.core.cache.SlaveConnection;
+import com.zy.core.enums.SlaveType;
+import com.zy.core.model.protocol.StaProtocol;
+import com.zy.core.thread.SiemensDevpThread;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Created by Monkey D. Luffy on 2023.07.25
+ * 寰愬伐姹変簯..............浠ヤ笅.............涓婇ザ姹熼摐.............鎷嗗灈淇℃伅涓婁紶
+ */
+@Slf4j
+@Service
+@Transactional
+public class ReportToDismantleTheStackHandler extends AbstractHandler<String> {
+
+ @Autowired
+ private WrkMastService wrkMastService;
+ @Autowired
+ private WrkDetlSingleService wrkDetlSingleService;
+ @Autowired
+ private WrkDetlService wrkDetlService;
+ @Autowired
+ private StaDescService staDescService;
+ @Autowired
+ private ApiLogService apiLogService;
+ @Autowired
+ private BasDevpService basDevpService;
+
+// @Value("${srHangJia.url}")
+ private String erpUrl = "192.168.18.229:16126";
+// @Value("${srHangJia.reportOutPath}")
+ private String reportOutPath = "api/DepalletizingInfo/Post";
+
+ public ReturnT<String> start(int staNo) {
+ try {
+ Date now = new Date();
+ BasDevp basDevp = basDevpService.selectById(staNo);
+ Integer staOther = getStaOther(staNo);
+ Integer staEnd = getStaEnd(staNo);
+ if (staOther==0) return FAIL;
+
+ SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1);
+ StaProtocol staProtocol = devpThread.getStation().get(staNo);
+ if (staProtocol == null) {
+ return FAIL;
+ } else {
+ staProtocol = staProtocol.clone();
+ }
+
+ StaProtocol staProtocolOther = devpThread.getStation().get(staOther);
+ if (staProtocolOther == null) {
+ return FAIL;
+ } else {
+ staProtocolOther = staProtocolOther.clone();
+ }
+
+
+ StaProtocol staProtocolEnd = devpThread.getStation().get(staEnd);
+ if (staProtocolEnd == null) {
+ return FAIL;
+ } else {
+ staProtocolEnd = staProtocolEnd.clone();
+ }
+
+
+ BasDevp basDevpOther = basDevpService.selectById(staOther);
+ if (Cools.isEmpty(basDevpOther) || basDevpOther.getReportSign()==1){
+ return FAIL;
+ }
+
+
+ BasDevp basDevpEnd = basDevpService.selectById(staEnd);
+ if (!basDevpEnd.getLoading().equals("Y") || !basDevpEnd.getAutoing().equals("Y") || !basDevpEnd.getInEnable().equals("Y")){
+ return FAIL;
+ }
+ if (!staProtocolEnd.isLoading() || !staProtocolEnd.isAutoing() || !staProtocolEnd.isInEnable() ){
+ return FAIL;
+ }
+
+ if ((basDevpEnd.getWrkNo()<9900 && basDevpEnd.getWrkNo()!=0 ) || basDevpEnd.getWrkNo()>10000 || basDevpEnd.getReportSign()!=0){
+ return FAIL;
+ }
+ if ((staProtocolEnd.getWorkNo()<9900 && staProtocolEnd.getWorkNo()!=0 ) || staProtocolEnd.getWorkNo()>10000){
+ return FAIL;
+ }
+
+ WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("io_type", 202).eq("source_sta_no", staEnd).eq("wrk_sts",51L));
+ if (!Cools.isEmpty(wrkMast1)) return FAIL;
+ if (!Cools.isEmpty(basDevp) && basDevp.getAutoing().equals("Y") && basDevp.getWrkNo()!=0){ //涓婁紶鍓嶅伐浣滃彿璺熺數鎺х害瀹氫负9992涓帶(妗佹灦)锛氱爜鍨涘畬鎴愪笅鍙戝叆搴撲俊鎭紙浣犲彲浠ヨ嚜瀹氫箟锛�
+ if (staProtocol.isAutoing() && staProtocol.getWorkNo()!=0){
+ WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", basDevp.getWrkNo()));
+ if (Cools.isEmpty(wrkMast) || Cools.isEmpty(wrkMast.getSheetNo()) || !wrkMast.getSheetNo().equals("0")){
+ return FAIL;
+ }
+ List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
+ if (Cools.isEmpty(wrkDetls) || wrkDetls.isEmpty()){
+ return FAIL;
+ }
+ List<WrkDetl> wrkDetlList = new ArrayList<>();
+ String signOne = "";
+ String signTwo = "";
+ for (WrkDetl wrkDetl:wrkDetls){
+ if (wrkDetl.getOrigin().equals("1") && signOne.equals("")){
+ wrkDetlList.add(wrkDetl);
+ signOne = "1";
+ } else if (wrkDetl.getOrigin().equals("2") && signTwo.equals("")){
+ wrkDetlList.add(wrkDetl);
+ signTwo = "2";
+ }
+ if (!signOne.equals("") && !signTwo.equals("")){
+ break;
+ }
+ }
+ SingleMountUnstackingCompleteParam singleMountUnstackingCompleteParam = new SingleMountUnstackingCompleteParam(wrkMast,wrkDetlList);
+ singleMountUnstackingCompleteParam.setStaStart(staNo);
+ singleMountUnstackingCompleteParam.setStaEnd(staEnd);
+// result = null;
+// if (true){
+// return FAIL;
+// }
+ log.error("涓婁紶鏈烘鑷傛椂锛岀珯鐐圭姸鎬侊細"+JSON.toJSONString(basDevpEnd));
+ log.error("涓婁紶鏈烘鑷傛椂锛屽伐浣滃彿锛�"+JSON.toJSONString(wrkMast));
+ ReturnT<String> result = postMesData(reportOutPath,singleMountUnstackingCompleteParam);
+// System.out.println(result);
+// if (true){
+// for (WrkDetl wrkDetl:wrkDetls){
+// WrkDetlSingle wrkDetlSingle = new WrkDetlSingle();
+// wrkDetlSingle.sync(wrkDetl);
+// wrkDetlSingle.setWrkNo(wrkDetl.getWrkNo().longValue());
+// wrkDetlSingleService.insert(wrkDetlSingle);
+// }
+// wrkMast.setSheetNo("1");
+// wrkMastService.updateById(wrkMast);
+// basDevp.setReportSign(1);
+// basDevpService.updateById(basDevp);
+// basDevpEnd.setReportSign(1);
+// basDevpService.updateById(basDevp);
+// return SUCCESS;
+// }
+ if (result.getCode()==200){
+ Date nowOne = new Date();
+ Date nowTwo = now;
+ for (WrkDetl wrkDetl:wrkDetls){
+ if (wrkDetl.getOrigin().equals("1")){
+ now = nowOne;
+ } else if (wrkDetl.getOrigin().equals("2")){
+ now = nowTwo;
+ }
+ WrkDetlSingle wrkDetlSingle = new WrkDetlSingle();
+ wrkDetlSingle.sync(wrkDetl);
+ wrkDetlSingle.setWrkNo(wrkDetl.getWrkNo().longValue());
+ wrkDetlSingle.setIoTime(now);
+ wrkDetlSingleService.insert(wrkDetlSingle);
+ }
+ wrkMast.setSheetNo("1");
+ wrkMastService.updateById(wrkMast);
+ basDevp.setReportSign(1);
+ basDevpService.updateById(basDevp);
+ basDevpEnd.setReportSign(1);
+ basDevpService.updateById(basDevpEnd);
+
+ return SUCCESS;
+ }else {
+ log.error("鎷嗗灈淇℃伅涓婁紶澶辫触");
+ }
+ }
+ }
+ }catch (Exception e){
+ log.error("寮傚父锛侊紒锛�"+e);
+ return FAIL;
+ }
+ return FAIL;
+ }
+
+ private ReturnT<String> postMesData(String erpPath,Object combParam){
+ if(combParam != null){
+ String response = "";
+ boolean success = false;
+ try {
+ response = new HttpHandler.Builder()
+ .setUri(erpUrl)
+ .setPath(erpPath)
+ .setJson(JSON.toJSONString(combParam))
+ .build()
+ .doPost();
+ JSONObject jsonObject = JSON.parseObject(response);
+ if (jsonObject.getInteger("Code")==200) {
+ success = true;
+ } else {
+ log.error("鎷嗗灈淇℃伅涓婁紶璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}"+erpUrl+erpPath, JSON.toJSONString(combParam), response);
+ throw new CoolException("涓婃姤erp绯荤粺澶辫触");
+ }
+ } catch (Exception e) {
+ log.error("fail", e);
+// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+ return FAIL.setMsg(e.getMessage());
+ } finally {
+ try {
+ // 淇濆瓨鎺ュ彛鏃ュ織
+ apiLogService.save(
+ "涓婃姤妗佹灦绯荤粺",
+ erpUrl + erpPath,
+ null,
+ erpUrl,
+ JSON.toJSONString(combParam),
+ response,
+ success
+ );
+ } catch (Exception e) { log.error("", e); }
+ }
+ }
+ return SUCCESS;
+ }
+
+ public Integer getStaOther(Integer staNo){
+ switch (staNo){
+ case 118:
+ return 119;
+ case 119:
+ return 118;
+ case 120:
+ return 121;
+ case 121:
+ return 120;
+ default:
+ return 0;
+ }
+ }
+
+ public Integer getStaEnd(Integer staNo){
+ switch (staNo){
+ case 118:
+ case 119:
+ return 131;
+ case 120:
+ case 121:
+ return 135;
+ default:
+ return 0;
+ }
+ }
+
+ public boolean isReportSign(StaProtocol staProtocol){
+ if (staProtocol.isAutoing() && !staProtocol.isLoadingSuper() && !staProtocol.isLoading()){
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/src/main/java/com/zy/common/CodeBuilder.java b/src/main/java/com/zy/common/CodeBuilder.java
index 33131f2..23fa82f 100644
--- a/src/main/java/com/zy/common/CodeBuilder.java
+++ b/src/main/java/com/zy/common/CodeBuilder.java
@@ -17,10 +17,10 @@
// generator.table="sys_host";
// sqlserver
generator.sqlOsType = SqlOsType.SQL_SERVER;
- generator.url="localhost:1433;databasename=xjhsasrs";
+ generator.url="192.168.4.15:1433;databasename=srjtasrs";
generator.username="sa";
generator.password="sa@123";
- generator.table="asr_bas_rgv_err_log";
+ generator.table="man_api_log";
generator.packagePath="com.zy.asrs";
generator.controller = false;
diff --git a/src/main/java/com/zy/common/utils/Synchro.java b/src/main/java/com/zy/common/utils/Synchro.java
new file mode 100644
index 0000000..c23fbf1
--- /dev/null
+++ b/src/main/java/com/zy/common/utils/Synchro.java
@@ -0,0 +1,38 @@
+package com.zy.common.utils;
+
+import com.core.exception.CoolException;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+
+/**
+ * Created by vincent on 2022/4/1
+ */
+public class Synchro {
+
+ public static void Copy(Object source, Object dest) {
+ try {
+ BeanInfo sourceBean = Introspector.getBeanInfo(source.getClass(),Object.class);
+ PropertyDescriptor[] sourceProperty = sourceBean.getPropertyDescriptors();
+ BeanInfo destBean = Introspector.getBeanInfo(dest.getClass(),Object.class);
+ PropertyDescriptor[] destProperty = destBean.getPropertyDescriptors();
+ for (PropertyDescriptor propertyDescriptor : sourceProperty) {
+ for (PropertyDescriptor descriptor : destProperty) {
+ if (propertyDescriptor.getName().equals(descriptor.getName()) && propertyDescriptor.getPropertyType() == descriptor.getPropertyType()) {
+ Method readMethod = propertyDescriptor.getReadMethod();
+ Method writeMethod = descriptor.getWriteMethod();
+ if (null != writeMethod && null != readMethod) {
+ writeMethod.invoke(dest, readMethod.invoke(source));
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw new CoolException("灞炴�у鍒跺け璐�:" + e.getMessage());
+ }
+ }
+
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 888f0fc..90287aa 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -8,12 +8,12 @@
name: @pom.build.finalName@
datasource:
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-# url: jdbc:sqlserver://192.168.18.4:49977;databasename=srjtasrs
-# username: sa
-# password: sa@123
- url: jdbc:sqlserver://127.0.0.1:49977;databasename=srjtasrs
+ url: jdbc:sqlserver://192.168.18.4:49977;databasename=srjtasrs
username: sa
password: sa@123
+# url: jdbc:sqlserver://127.0.0.1:49977;databasename=srjtasrs
+# username: sa
+# password: sa@123
# url: jdbc:sqlserver://127.0.0.1:1433;databasename=srjtasrs
# username: sa
# password: sa@123
@@ -45,7 +45,7 @@
enable: false
wms:
- url: 127.0.0.1:8080/jtwms
+ url: 192.168.18.4:8080/jtwms
# 涓嬩綅鏈洪厤缃�
wcs-slave:
diff --git a/src/main/resources/mapper/ApiLogMapper.xml b/src/main/resources/mapper/ApiLogMapper.xml
new file mode 100644
index 0000000..b6b6566
--- /dev/null
+++ b/src/main/resources/mapper/ApiLogMapper.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.mapper.ApiLogMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.zy.asrs.entity.ApiLog">
+ <id column="id" property="id" />
+ <result column="uuid" property="uuid" />
+ <result column="namespace" property="namespace" />
+ <result column="url" property="url" />
+ <result column="appkey" property="appkey" />
+ <result column="timestamp" property="timestamp" />
+ <result column="client_ip" property="clientIp" />
+ <result column="request" property="request" />
+ <result column="response" property="response" />
+ <result column="err" property="err" />
+ <result column="result" property="result" />
+ <result column="status" property="status" />
+ <result column="create_time" property="createTime" />
+ <result column="update_time" property="updateTime" />
+ <result column="memo" property="memo" />
+
+ </resultMap>
+
+ <delete id="clearWeekBefore">
+ delete from man_api_log
+ where 1=1
+ and datediff(week,create_time,getdate()) >= 1
+ and result != 1
+ </delete>
+
+</mapper>
diff --git a/src/main/resources/mapper/WrkDetlMapper.xml b/src/main/resources/mapper/WrkDetlMapper.xml
index 6bd7ea2..20376be 100644
--- a/src/main/resources/mapper/WrkDetlMapper.xml
+++ b/src/main/resources/mapper/WrkDetlMapper.xml
@@ -37,4 +37,8 @@
and wrk_no = #{workNo}
</update>
+ <select id="selectByWrkNo" resultMap="BaseResultMap">
+ select * from asr_wrk_detl where 1=1 and wrk_no = #{wrkNo}
+ </select>
+
</mapper>
diff --git a/src/main/resources/mapper/WrkDetlSingleMapper.xml b/src/main/resources/mapper/WrkDetlSingleMapper.xml
new file mode 100644
index 0000000..db9aaad
--- /dev/null
+++ b/src/main/resources/mapper/WrkDetlSingleMapper.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zy.asrs.mapper.WrkDetlSingleMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.zy.asrs.entity.WrkDetlSingle">
+ <result column="wrk_no" property="wrkNo" />
+ <result column="io_time" property="ioTime" />
+ <result column="anfme" property="anfme" />
+ <result column="zpallet" property="zpallet" />
+ <result column="matnr" property="matnr" />
+ <result column="maktx" property="maktx" />
+ <result column="batch" property="batch" />
+ <result column="order_no" property="orderNo" />
+ <result column="specs" property="specs" />
+ <result column="model" property="model" />
+ <result column="color" property="color" />
+ <result column="brand" property="brand" />
+ <result column="unit" property="unit" />
+ <result column="price" property="price" />
+ <result column="sku" property="sku" />
+ <result column="units" property="units" />
+ <result column="barcode" property="barcode" />
+ <result column="origin" property="origin" />
+ <result column="manu" property="manu" />
+ <result column="manu_date" property="manuDate" />
+ <result column="item_num" property="itemNum" />
+ <result column="safe_qty" property="safeQty" />
+ <result column="weight" property="weight" />
+ <result column="length" property="length" />
+ <result column="volume" property="volume" />
+ <result column="three_code" property="threeCode" />
+ <result column="supp" property="supp" />
+ <result column="supp_code" property="suppCode" />
+ <result column="be_batch" property="beBatch" />
+ <result column="dead_time" property="deadTime" />
+ <result column="dead_warn" property="deadWarn" />
+ <result column="source" property="source" />
+ <result column="inspect" property="inspect" />
+ <result column="danger" property="danger" />
+ <result column="modi_user" property="modiUser" />
+ <result column="modi_time" property="modiTime" />
+ <result column="appe_user" property="appeUser" />
+ <result column="appe_time" property="appeTime" />
+ <result column="memo" property="memo" />
+ <result column="roll_up" property="rollUp" />
+
+ </resultMap>
+
+</mapper>
--
Gitblit v1.9.1