From 43a14ad6fbb68a9c0ce787acce28ce446aac13b0 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期四, 13 七月 2023 14:14:51 +0800
Subject: [PATCH] 添加扦样信息

---
 igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml        |   48 ++++++++
 igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java               |    2 
 igds-inout/src/main/java/models/inout.model.xml                           |   15 ++-
 igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml        |   81 +++++++++++++++
 igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java      |   76 ++++++++++++--
 igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java |    2 
 igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java            |   12 ++
 igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java              |   11 ++
 igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java          |   24 ++++
 9 files changed, 238 insertions(+), 33 deletions(-)

diff --git a/igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java b/igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java
index bc43862..330b71c 100644
--- a/igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java
+++ b/igds-core/src/main/java/com/ld/igds/inout/InoutConstant.java
@@ -192,7 +192,18 @@
      * 璁″垝鏄庣粏绫诲瀷 -杞叆璁″垝
      **/
     public static final String PLAN_DETAIL_TYPE_2 = "2";
+    /**
+     * 妫�娴嬬粨鏋� -鍚堟牸
+     */
+    public static final String RESULT_1 = "1";
+    /**
+     * 妫�娴嬬粨鏋� -涓嶅悎鏍�
+     */
+    public static final String RESULT_0 = "0";
 
+    public static final String SAMPLE_TYPE_MANUAL = "0";
+    public static final String SAMPLE_TYPE_AUTOMATIC = "1";
+    public static final String SAMPLE_TYPE_RANDOM = "2";
 
     /**
      * 鏍规嵁涓氬姟绫诲瀷鍜� 褰撳墠鐘舵�佽繑鍥炲綋鍓嶇姸鎬佺殑娴佺▼鍚嶇О
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java
index 50a29a8..010e7ac 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutDataPR.java
@@ -42,9 +42,8 @@
     private InoutReportManager inoutReportManager;
     @Resource
     private InoutManager inoutManager;
-    
-    
-    
+
+
     // ${dorado.getDataProvider("inoutDataPR#triggerRecordStatus1").getResult()}
     @DataProvider
     public List<DicTrigger> triggerRecordStatus1() {
@@ -54,6 +53,25 @@
         return list;
     }
 
+    // ${dorado.getDataProvider("inoutDataPR#triggerResult").getResult()}
+    @DataProvider
+    public List<DicTrigger> triggerResult() {
+        List<DicTrigger> list = new ArrayList<DicTrigger>();
+        list.add(new DicTrigger(InoutConstant.RESULT_1, "鍚堟牸"));
+        list.add(new DicTrigger(InoutConstant.RESULT_0, "涓嶅悎鏍�"));
+        return list;
+    }
+
+    // ${dorado.getDataProvider("inoutDataPR#triggerSampleType").getResult()}
+    @DataProvider
+    public List<DicTrigger> triggerSampleType() {
+        List<DicTrigger> list = new ArrayList<DicTrigger>();
+        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_MANUAL, "浜哄伐"));
+        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_AUTOMATIC, "鑷姩"));
+        list.add(new DicTrigger(InoutConstant.SAMPLE_TYPE_RANDOM, "鏅鸿兘闅忔満"));
+        return list;
+    }
+
     /**
      * inoutDataPR#pageInoutData
      *
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml
index 3e27763..4f4abfe 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml
+++ b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml
@@ -108,6 +108,34 @@
         <Property></Property>
         <Property name="label">杩愮畻绗﹀彿</Property>
       </PropertyDef>
+      <PropertyDef name="operaSymbolValue">
+        <Property/>
+      </PropertyDef>
+      <PropertyDef name="addNum">
+        <Property name="dataType">Double</Property>
+        <Property name="label">澧為噸</Property>
+      </PropertyDef>
+      <PropertyDef name="deNum">
+        <Property name="dataType">Double</Property>
+        <Property name="label">鎵i噸</Property>
+      </PropertyDef>
+      <PropertyDef name="addPrice">
+        <Property name="dataType">Double</Property>
+        <Property name="label">澧炰环</Property>
+      </PropertyDef>
+      <PropertyDef name="dePrice">
+        <Property name="dataType">Double</Property>
+        <Property name="label">鎵d环</Property>
+      </PropertyDef>
+      <PropertyDef name="result">
+        <Property/>
+        <Property name="label">妫�楠岀粨鏋�</Property>
+        <Property name="mapping">
+          <Property name="keyProperty">code</Property>
+          <Property name="valueProperty">name</Property>
+          <Property name="mapValues">${dorado.getDataProvider(&quot;inoutDataPR#triggerResult&quot;).getResult()}</Property>
+        </Property>
+      </PropertyDef>
     </DataType>
   </Model>
   <View layout="padding:5;regionPadding:5">
@@ -556,8 +584,29 @@
               <Property name="label">璐ㄦ鏃堕棿</Property>
               <Editor/>
             </AutoFormElement>
+            <AutoFormElement>
+              <Property name="name">sampleUser</Property>
+              <Property name="property">sampleUser</Property>
+              <Editor/>
+            </AutoFormElement>
+            <AutoFormElement>
+              <Property name="name">sampleTime</Property>
+              <Property name="property">sampleTime</Property>
+              <Editor/>
+            </AutoFormElement>
+            <AutoFormElement>
+              <Property name="name">sampleType</Property>
+              <Property name="property">sampleType</Property>
+              <Property name="editorType">RadioGroup</Property>
+              <Editor/>
+            </AutoFormElement>
           </AutoForm>
           <DataGrid id="dataGridCheckItem" layoutConstraint="padding:10">
+            <ClientEvent name="onCellValueEdit">var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
+if(data){&#xD;
+	console.log(data,&quot;inoutHand&quot;);&#xD;
+}&#xD;
+</ClientEvent>
             <Property name="dataSet">dsMain</Property>
             <Property name="dataPath">#.checkItems</Property>
             <Property name="highlightCurrentRow">false</Property>
@@ -579,14 +628,38 @@
               <Property name="property">unit</Property>
               <Property name="width">80</Property>
               <Property name="readOnly">true</Property>
-            </DataColumn>
-            <DataColumn name="standardValue">
-              <Property name="property">standardValue</Property>
-              <Property name="readOnly">true</Property>
               <Property name="align">center</Property>
+            </DataColumn>
+            <DataColumn name="operaSymbolValue">
+              <Property name="property">operaSymbolValue</Property>
+              <Property name="align">center</Property>
+              <Property name="caption">鏍囧噯鍊�</Property>
+              <Property name="readOnly">true</Property>
+            </DataColumn>
+            <DataColumn name="deNum">
+              <Property name="property">deNum</Property>
+              <Property name="align">center</Property>
+            </DataColumn>
+            <DataColumn name="addNum">
+              <Property name="property">addNum</Property>
+              <Property name="align">center</Property>
+            </DataColumn>
+            <DataColumn name="dePrice">
+              <Property name="property">dePrice</Property>
+              <Property name="align">center</Property>
+            </DataColumn>
+            <DataColumn name="addPrice">
+              <Property name="property">addPrice</Property>
+              <Property name="align">center</Property>
+            </DataColumn>
+            <DataColumn name="result">
+              <Property name="property">result</Property>
+              <Property name="align">center</Property>
+              <Property name="readOnly">true</Property>
             </DataColumn>
             <DataColumn name="remarks">
               <Property name="property">remarks</Property>
+              <Property name="align">center</Property>
             </DataColumn>
           </DataGrid>
         </Container>
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml
index fa9fff5..74a5668 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml
+++ b/igds-inout/src/main/java/com/ld/igds/inout/view/InoutList.view.xml
@@ -978,6 +978,22 @@
                   <Property name="label">璐ㄦ鏃堕棿</Property>
                   <Editor/>
                 </AutoFormElement>
+                <AutoFormElement>
+                  <Property name="name">sampleUser</Property>
+                  <Property name="property">sampleUser</Property>
+                  <Editor/>
+                </AutoFormElement>
+                <AutoFormElement>
+                  <Property name="name">sampleTime</Property>
+                  <Property name="property">sampleTime</Property>
+                  <Editor/>
+                </AutoFormElement>
+                <AutoFormElement>
+                  <Property name="name">sampleType</Property>
+                  <Property name="property">sampleType</Property>
+                  <Property name="editorType">RadioGroup</Property>
+                  <Editor/>
+                </AutoFormElement>
               </AutoForm>
               <DataGrid id="dataGridCheckItem" layoutConstraint="padding:10">
                 <Property name="dataSet">dsMain</Property>
@@ -1001,14 +1017,38 @@
                   <Property name="property">unit</Property>
                   <Property name="width">80</Property>
                   <Property name="readOnly">true</Property>
-                </DataColumn>
-                <DataColumn name="standardValue">
-                  <Property name="property">standardValue</Property>
-                  <Property name="readOnly">true</Property>
                   <Property name="align">center</Property>
+                </DataColumn>
+                <DataColumn name="operaSymbolValue">
+                  <Property name="property">operaSymbolValue</Property>
+                  <Property name="align">center</Property>
+                  <Property name="caption">鏍囧噯鍊�</Property>
+                  <Property name="readOnly">true</Property>
+                </DataColumn>
+                <DataColumn name="deNum">
+                  <Property name="property">deNum</Property>
+                  <Property name="align">center</Property>
+                </DataColumn>
+                <DataColumn name="addNum">
+                  <Property name="property">addNum</Property>
+                  <Property name="align">center</Property>
+                </DataColumn>
+                <DataColumn name="dePrice">
+                  <Property name="property">dePrice</Property>
+                  <Property name="align">center</Property>
+                </DataColumn>
+                <DataColumn name="addPrice">
+                  <Property name="property">addPrice</Property>
+                  <Property name="align">center</Property>
+                </DataColumn>
+                <DataColumn name="result">
+                  <Property name="property">result</Property>
+                  <Property name="align">center</Property>
+                  <Property name="readOnly">true</Property>
                 </DataColumn>
                 <DataColumn name="remarks">
                   <Property name="property">remarks</Property>
+                  <Property name="align">center</Property>
                 </DataColumn>
               </DataGrid>
             </Container>
diff --git a/igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java b/igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java
index 9f5bd25..e2a1900 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/InoutManageUtil.java
@@ -82,6 +82,8 @@
      */
     public static final String CACHE_VARIETY_ID = "VARIETY_ID";
 
+    public static final String CACHE_LOSS_OVER_ID = "LOSS_OVER_ID";
+
     /**
      * 鏍规嵁绫诲瀷鍒涘缓璁″垝ID
      *
diff --git a/igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java b/igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java
index 0b3adf1..9d9eda4 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/service/HLossOverService.java
@@ -2,15 +2,21 @@
 
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import javax.annotation.Resource;
 import javax.transaction.Transactional;
 
+import com.ld.igds.constant.RedisConst;
 import com.ld.igds.inout.InoutConstant;
 import com.ld.igds.inout.dto.InoutData;
 import com.ld.igds.inout.dto.InoutParam;
 import com.ld.igds.inout.service.InoutService;
+import com.ld.igds.m.InoutManageUtil;
 import com.ld.igds.models.InoutLossOver;
+import com.ld.igds.models.InoutVarietyChange;
 import com.ld.igds.util.DateUtil;
+import com.ld.igds.util.RedisUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.apache.commons.lang3.time.DateUtils;
@@ -25,6 +31,8 @@
 @Component
 public class HLossOverService extends HibernateDao {
 
+    @Resource
+    private RedisUtil redisUtil;
     @Autowired
     private InoutService inoutService;
 
@@ -78,18 +86,6 @@
         data.setUpdateUser(ContextUtil.getLoginUserCName());
 
 
-        InoutParam param = new InoutParam();
-        param.setCompanyId(ContextUtil.getCompanyId());
-        param.setDepotId(data.getDepotId());
-        param.setProgress(InoutConstant.PROGRESS_RECORD);
-
-        InoutData inoutData = inoutService.getLastRecord(param);
-
-        if (null != inoutData && null != inoutData.getCompleteTime() &&
-                data.getSubmitTime().before(inoutData.getCompleteTime())) {
-            throw new Exception("鐧昏鏃堕棿涓嶈兘鏃╀簬鏈�鍚庝竴杈嗚溅瀹屾垚鏃堕棿锛�" + DateFormatUtils.format(inoutData.getCompleteTime(), "yyyy-MM-dd HH:mm"));
-        }
-
         try {
             if (null == data.getId()) {
                 IUser user = ContextUtil.getLoginUser();
@@ -106,8 +102,8 @@
                 if (data.getSubmitTime().before(curDate)) {
                     data.setSubmitTime(curDate);
                 }
-
-                String id = addInoutDataByLossOver(data);
+                String id = createId(data.getSubmitTime(), data.getCompanyId(), data.getHwdm());
+//                String id = addInoutDataByLossOver(data);
 
                 data.setId(id);
 
@@ -188,4 +184,56 @@
         inoutService.delInoutDataByLossOver(param);
     }
 
+    public List<InoutLossOver> getMaxId(Map<String, Object> param) {
+
+        String hql = "from " + InoutLossOver.class.getName() + " where 1 = 1 ";
+        Map<String, Object> args = new HashMap<String, Object>();
+        if (null != param) {
+            String str = (String) param.get("timeKey");
+            if (StringUtils.isNotEmpty(str)) {
+                hql += " and id like :timeKey";
+                args.put("timeKey", str);
+            }
+        }
+        hql += " order by  id desc ";
+        return this.query(hql, args);
+    }
+
+    public String createId(Date date, String companyId, String freightId) {
+        // 鏃堕棿鎴虫爣绛�
+        String timeKey = DateFormatUtils.format(date, "yyyyMMdd");
+
+        // 浠庣紦瀛樹腑鑾峰彇宸叉湁鐨勭粍缁囩紪鐮�
+        String cacheKey = RedisConst.buildKey(companyId,
+                InoutManageUtil.CACHE_LOSS_OVER_ID);
+
+        String cacheId = (String) redisUtil.get(cacheKey);
+
+        if (null != cacheId && cacheId.indexOf(freightId + timeKey) >= 0) {
+            String temp = cacheId.substring(cacheId.length() - 3);
+            Integer i = Integer.valueOf(temp);
+            cacheId = freightId + timeKey + String.format("%03d", ++i);
+        } else {
+            Map<String, Object> args = new HashMap<>();
+            args.put("timeKey", freightId + timeKey + "%");
+            List<InoutLossOver> result = getMaxId(args);
+
+            if (null == result || result.size() == 0) {
+                cacheId = freightId + timeKey + "001";
+            } else {
+                int max = 0;
+                int num;
+                for (InoutLossOver inoutLossOver : result) {
+                    num = Integer.parseInt(inoutLossOver.getId().substring(inoutLossOver.getId().length() - 3));
+                    max = Math.max(max, num);
+                }
+                cacheId = freightId + timeKey + String.format("%03d", ++max);
+            }
+        }
+        // 鏇存柊缂撳瓨
+        redisUtil.set(cacheKey, cacheId);
+
+        return cacheId;
+    }
+
 }
diff --git a/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java b/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java
index 24fe0fe..6a8c3bc 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/service/HVarietyChangeService.java
@@ -158,7 +158,7 @@
             cacheId = freightId + timeKey + String.format("%03d", i);
         } else {
             Map<String, Object> args = new HashMap<>();
-            args.put("timeKey", "%" + freightId + timeKey + "%");
+            args.put("timeKey", freightId + timeKey + "%");
             List<InoutVarietyChange> result = getMaxId(args);
 
             if (null == result || result.size() == 0) {
diff --git a/igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java b/igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java
index 795d17c..694bfdb 100644
--- a/igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java
+++ b/igds-inout/src/main/java/com/ld/igds/models/InoutLossOver.java
@@ -27,7 +27,7 @@
 
     @Id
     @Column(name = "ID_", length = 40)
-    @PropertyDef(label = "涓婚敭")
+    @PropertyDef(label = "鎹熺泭鍗曞彿", description = "鐢辫揣浣嶄唬鐮�+涓氬姟鏃ユ湡(yyyyMMdd)+3浣嶉『搴忓彿缁勬垚")
     private String id;
 
     @Column(name = "COMPANY_ID_", length = 10)
@@ -41,6 +41,10 @@
     @Column(name = "DEPOT_ID_", length = 50)
     @PropertyDef(label = "鎵�灞炰粨搴�")
     private String depotId;
+
+    @Column(name = "hwdm", length = 50)
+    @PropertyDef(label = "璐т綅浠g爜")
+    private String hwdm;
 
     @Column(name = "TYPE_", length = 10)
     @PropertyDef(label = "绫诲瀷", description = "鎹熻��/婧㈠嚭")
@@ -85,7 +89,7 @@
     private double ckzz;
 
     @Column(name = "AMOUNT_")
-    @PropertyDef(label = "閲嶉噺", description = "鎹熸孩鏁伴噺KG")
+    @PropertyDef(label = "閲嶉噺", description = "鎹熸孩鏁伴噺KG锛涙崯鑰椾负姝f暟锛屾孩浣欎负璐熸暟")
     private Double amount;
 
 //	@PropertyDef(label = "鍏朵腑锛氭垚璐т綅鍓嶆崯鑰�(鍏枻)" )
@@ -184,4 +188,8 @@
     @PropertyDef(label = "鏇存柊浜�")
     private String updateUser;
 
+    @PropertyDef(label = "鎿嶄綔鏍囧織", description = "i:鏂板鏁版嵁锛堥粯璁わ級u:鏇存柊鏁版嵁d:鍒犻櫎鏁版嵁")
+    @Column(name = "czbz", length = 1)
+    private String czbz;
+
 }
diff --git a/igds-inout/src/main/java/models/inout.model.xml b/igds-inout/src/main/java/models/inout.model.xml
index ff5ada6..69a099a 100644
--- a/igds-inout/src/main/java/models/inout.model.xml
+++ b/igds-inout/src/main/java/models/inout.model.xml
@@ -75,7 +75,7 @@
       </Property>
     </PropertyDef>
     <PropertyDef name="khlx">
-      <Property/>
+      <Property></Property>
       <Property name="label">瀹㈡埛绫诲瀷</Property>
       <Property name="mapping">
         <Property name="mapValues">${dorado.getDataProvider(&quot;contractManagePR#triggerCustomerType&quot;).getResult()}</Property>
@@ -84,19 +84,19 @@
       </Property>
     </PropertyDef>
     <PropertyDef name="khbh">
-      <Property/>
+      <Property></Property>
       <Property name="label">瀹㈡埛缂栫爜</Property>
     </PropertyDef>
     <PropertyDef name="fddbr">
-      <Property/>
+      <Property></Property>
       <Property name="label">娉曞畾浠h〃浜�</Property>
     </PropertyDef>
     <PropertyDef name="yzbm">
-      <Property/>
+      <Property></Property>
       <Property name="label">閭斂缂栫爜</Property>
     </PropertyDef>
     <PropertyDef name="dzyx">
-      <Property/>
+      <Property></Property>
       <Property name="label">鐢靛瓙淇$</Property>
     </PropertyDef>
     <PropertyDef name="updateTime">
@@ -387,6 +387,11 @@
     <PropertyDef name="sampleType">
       <Property></Property>
       <Property name="label">鎵︽牱鏂瑰紡</Property>
+      <Property name="mapping">
+        <Property name="mapValues">${dorado.getDataProvider(&quot;inoutDataPR#triggerSampleType&quot;).getResult()}</Property>
+        <Property name="keyProperty">code</Property>
+        <Property name="valueProperty">name</Property>
+      </Property>
     </PropertyDef>
     <PropertyDef name="deCheck">
       <Property name="dataType">double</Property>

--
Gitblit v1.9.3