From 57f9a55581343a805cd589bbdc00e4d28a28aa97 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期一, 28 七月 2025 13:26:42 +0800
Subject: [PATCH] erp对接

---
 src/main/java/com/zy/asrs/entity/OrderDetl.java |   98 ++++++++++++++++++++++++++++---------------------
 1 files changed, 56 insertions(+), 42 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/OrderDetl.java b/src/main/java/com/zy/asrs/entity/OrderDetl.java
index 2ab47e1..3c740bb 100644
--- a/src/main/java/com/zy/asrs/entity/OrderDetl.java
+++ b/src/main/java/com/zy/asrs/entity/OrderDetl.java
@@ -6,20 +6,19 @@
 import com.baomidou.mybatisplus.enums.IdType;
 import com.core.common.Cools;
 import com.core.common.SpringUtils;
-import com.core.exception.CoolException;
+import com.zy.asrs.service.DocTypeService;
 import com.zy.asrs.service.OrderService;
+import com.zy.common.utils.Synchro;
 import com.zy.system.entity.User;
 import com.zy.system.service.UserService;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
 
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
 import java.io.Serializable;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Objects;
 
 @Data
 @TableName("man_order_detl")
@@ -58,10 +57,20 @@
     /**
      * 浣滀笟鏁伴噺
      *
-     *  1. 鍏ュ簱 : qty 馃憜
-     *  1. 鍑哄簱 : qty 馃憜
+     *  鍏ュ簱 : 缁勬墭瀹屾垚锛岀粍鎵樻。銆佸伐浣滄。銆佸叆搴撳畬鎴愭暟閲�
+     *  鍑哄簱 : 宸ヤ綔妗c�佸嚭搴撳畬鎴愭暟閲�
      */
     @ApiModelProperty(value= "浣滀笟鏁伴噺")
+    @TableField("work_qty")
+    private Double workQty;
+
+    /**
+     * 瀹屾垚鏁伴噺
+     *
+     *  鍏ュ簱 : qty 馃憜
+     *  鍑哄簱 : qty 馃憜
+     */
+    @ApiModelProperty(value= "瀹屾垚鏁伴噺")
     private Double qty;
 
     /**
@@ -125,9 +134,9 @@
     private String sku;
 
     /**
-     * 鍗曚綅閲�
+     * 涓婃姤鏁伴噺
      */
-    @ApiModelProperty(value= "鍗曚綅閲�")
+    @ApiModelProperty(value= "涓婃姤鏁伴噺")
     private Double units;
 
     /**
@@ -229,15 +238,15 @@
     private Integer deadWarn;
 
     /**
-     * 鍒惰喘 1: 鍒堕��  2: 閲囪喘  3: 澶栧崗
+     * 鍒惰喘 1: 鍒堕��  2: 閲囪喘  3: 澶栧崗     銆併�佸疁绉戯細  鏄惁纭   1: 纭  2: 鏈‘璁�
      */
     @ApiModelProperty(value= "鍒惰喘 1: 鍒堕��  2: 閲囪喘  3: 澶栧崗  ")
     private Integer source;
 
     /**
-     * 瑕佹眰妫�楠� 1: 鏄�  0: 鍚�
+     * 鏄惁涓婃姤 1: 鏄�  0: 鍚�   2: 绛夊緟涓婃姤
      */
-    @ApiModelProperty(value= "瑕佹眰妫�楠� 1: 鏄�  0: 鍚�  ")
+    @ApiModelProperty(value= "鏄惁涓婃姤 1: 鏄�  0: 鍚�   2: 绛夊緟涓婃姤")
     private Integer inspect;
 
     /**
@@ -379,18 +388,6 @@
         }
     }
 
-    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 getStatus$(){
         if (null == this.status){ return null; }
         switch (this.status){
@@ -436,30 +433,47 @@
     }
 
     public Double getEnableQty() {
-        if (null != this.anfme && this.qty != null) {
-            return this.anfme - this.qty;
+        if (null != this.anfme && this.workQty != null) {
+            return this.anfme - this.workQty;
         }
+//        if (null != this.anfme && this.qty != null) {
+//            return this.anfme - this.qty;
+//        }
         return null;
     }
 
-    public void sync(Object dest) {
-        try {
-            BeanInfo sourceBean = Introspector.getBeanInfo(this.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()) {
-                        descriptor.getWriteMethod().invoke(dest, propertyDescriptor.getReadMethod().invoke(this));
-                        break;
-                    }
-                }
-            }
-        } catch (Exception e) {
-            throw new CoolException("灞炴�у鍒跺け璐�:" + e.getMessage());
+    public String getQty$(){
+        if (getAnfme().equals(getQty())){
+            return "宸插畬鎴�";
         }
+        return "鏈畬鎴�";
     }
 
+    public void sync(Object source) {
+        Synchro.Copy(source, this);
+    }
 
-}
+    public String getAnfme$(){
+        if(Objects.equals(this.qty, this.anfme)){
+            return "宸插畬鎴�";
+        }else if(this.workQty==0){
+            return "寰呭鐞�";
+        }else if(this.anfme>this.qty){
+            return "浣滀笟涓�";
+        }else if(this.anfme<this.qty){
+            return "寮傚父";
+        }
+        return "";
+    }
+
+    public String getDanger$(){
+        DocTypeService service = SpringUtils.getBean(DocTypeService.class);
+        OrderService orderServicer=SpringUtils.getBean(OrderService.class);
+        Order order = orderServicer.selectByNo(this.orderNo);
+        DocType docType = service.selectById(order.getDocType());
+        if (!Cools.isEmpty(docType)){
+            return String.valueOf(docType.getDocName());
+        }
+        return null;
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.1