From 607e62cd6ec91d53bac549299d986c23e5143d28 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期三, 31 五月 2023 15:06:47 +0800
Subject: [PATCH] 出入库优化-称重相关方法

---
 igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java                              |   28 ++++
 igds-web/src/main/resources/templates/admin/inout/in-weight.html                       |    5 
 igds-core/src/main/java/com/ld/igds/common/CoreCommonService.java                      |    1 
 igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java             |    1 
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java             |   49 ++++---
 igds-web/src/main/resources/static/admin/inout/in-weight.js                            |   47 +------
 igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java |    2 
 igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java             |   70 +++++------
 igds-inout/src/main/java/com/ld/igds/io/dto/WeightDto.java                             |    2 
 igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java                  |   70 +++++------
 igds-core/src/main/java/com/ld/igds/models/InoutConf.java                              |    4 
 igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController2.java            |   22 ++-
 12 files changed, 146 insertions(+), 155 deletions(-)

diff --git a/igds-core/src/main/java/com/ld/igds/common/CoreCommonService.java b/igds-core/src/main/java/com/ld/igds/common/CoreCommonService.java
index fd1fbed..536a313 100644
--- a/igds-core/src/main/java/com/ld/igds/common/CoreCommonService.java
+++ b/igds-core/src/main/java/com/ld/igds/common/CoreCommonService.java
@@ -5,6 +5,7 @@
 import com.bstek.bdf2.core.model.DefaultCompany;
 import com.ld.igds.common.dto.DepotSerData;
 import com.ld.igds.common.dto.THDto;
+import com.ld.igds.data.SimpleDepot;
 import com.ld.igds.inout.dto.InoutData;
 import com.ld.igds.models.*;
 
diff --git a/igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java b/igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java
index 6f7362c..1cf5c88 100644
--- a/igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java
+++ b/igds-core/src/main/java/com/ld/igds/common/impl/CommonDataServiceImpl.java
@@ -70,6 +70,7 @@
     public List<Depot> getCacheDepotList(String companyId, String deptId) {
         if (null == deptId) return null;
         String patten = RedisConst.buildKey(companyId, RedisConst.KEY_DEPOT);
+
         Set<String> keys = redisUtil.keys(patten);
         if (null == keys) return null;
 
diff --git a/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java b/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
index e82212f..5f7193e 100644
--- a/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
+++ b/igds-core/src/main/java/com/ld/igds/common/manager/CommonManager.java
@@ -11,6 +11,7 @@
 import com.ld.igds.data.BaseParam;
 import com.ld.igds.data.Page;
 import com.ld.igds.data.PageResponse;
+import com.ld.igds.data.SimpleDepot;
 import com.ld.igds.grain.dto.GrainData;
 import com.ld.igds.grain.service.CoreGrainService;
 import com.ld.igds.inout.dto.InoutParam;
@@ -64,24 +65,45 @@
     private RedisUtil redisUtil;
 
     /**
-     * 鑾峰彇鍏ュ簱鐨勪笅鎷夋
+     * 鑾峰彇鍏ュ簱浣滀笟涓紝浠撳簱涓嬫媺妗嗭紝鍊艰幏鍙栫姸鎬�=闈炴弧浠撶殑绮簱
      *
      * @return
      */
-    public List<Depot> listInDepot() {
-        List<Depot> list = listDepot(true);
-        return list;
+    public List<SimpleDepot> getCacheDeptIn(String companyId, String deptId) {
+
+        List<SimpleDepot> result = new ArrayList<>();
+        List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId);
+
+        for (Depot depot : list) {
+            if (DepotStatus.STATUS_3.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_31.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_32.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_33.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_34.getCode().equals(depot.getDepotStatus())) continue;
+
+            result.add(new SimpleDepot(depot));
+        }
+
+        return result;
     }
 
     /**
-     * 鑾峰彇鍑哄簱鐨勪笅鎷夋
+     * 鑾峰彇鍑哄簱涓嬫媺妗嗗垪琛紝鑷姩灞忚斀绌轰粨
      *
      * @return
      */
-    public List<Depot> listOutDepot() {
-        List<Depot> list = listDepot(true);
+    public List<SimpleDepot> getCacheDeptOut(String companyId, String deptId) {
+        List<SimpleDepot> result = new ArrayList<>();
+        List<Depot> list = coreCommonService.getCacheDepotList(companyId, deptId);
 
-        return list;
+        for (Depot depot : list) {
+            if (DepotStatus.STATUS_1.getCode().equals(depot.getDepotStatus())) continue;
+            if (DepotStatus.STATUS_2.getCode().equals(depot.getDepotStatus())) continue;
+
+            result.add(new SimpleDepot(depot));
+        }
+
+        return result;
     }
 
     /**
@@ -117,38 +139,12 @@
     /**
      * 鏌ヨ閮ㄩ棬涓嬪睘鎵�鏈変粨搴撳垪琛�
      *
-     * @param isDelOther
+     * @param companyId
      * @param deptId
      * @return
      */
-    public List<Depot> listDepotByDeptId(boolean isDelOther, String deptId) {
-        String companyId = ContextUtil.getCompanyId();
-
-        if (StringUtils.isEmpty(deptId)) {
-            return null;
-        }
-
-        List<Depot> list = coreCommonService.getCacheDepotList(companyId);
-        if (null == list || list.isEmpty()) {
-            return list;
-        }
-
-        List<Depot> listDepot = new ArrayList<>();
-        for (Depot depot : list) {
-            if (depot.getDeptId().contains(deptId)) {
-                listDepot.add(depot);
-            }
-        }
-
-        // 鍒犻櫎闈炰粨搴撳垪琛�
-        if (isDelOther) {
-            return listDepot
-                    .stream()
-                    .filter(item -> !item.getDepotType().equals(
-                            DepotType.TYPE_99.getCode())).collect(Collectors.toList());
-        }
-
-        return listDepot;
+    public List<Depot> listDepotByDeptId(String companyId, String deptId) {
+        return coreCommonService.getCacheDepotList(companyId, deptId);
     }
 
     /**
diff --git a/igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java b/igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java
index c97c1de..6602824 100644
--- a/igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java
+++ b/igds-core/src/main/java/com/ld/igds/data/SimpleDepot.java
@@ -1,6 +1,7 @@
 package com.ld.igds.data;
 
 import com.bstek.dorado.annotation.PropertyDef;
+import com.ld.igds.models.Depot;
 import lombok.Data;
 
 import javax.persistence.Column;
@@ -37,4 +38,31 @@
 
     @PropertyDef(label = "浠撳簱鐘舵��", description = "涓庡簱瀛樿〃鍏宠仈锛岄�氳繃搴撳瓨鍙樻洿")
     private String depotStatus;
+
+
+    public SimpleDepot() {
+    }
+
+    public SimpleDepot(String id, String companyId, String deptId, String name, String buildingId, String granaryId, String depotType, String depotStatus) {
+        this.id = id;
+        this.companyId = companyId;
+        this.deptId = deptId;
+        this.name = name;
+        this.buildingId = buildingId;
+        this.granaryId = granaryId;
+        this.depotType = depotType;
+        this.depotStatus = depotStatus;
+    }
+
+    public SimpleDepot(Depot depot) {
+        this.id = depot.getId();
+        this.companyId = depot.getCompanyId();
+        this.deptId = depot.getDeptId();
+        this.name = depot.getName();
+        this.buildingId = depot.getBuildingId();
+        this.granaryId = depot.getGranaryId();
+        this.depotType = depot.getDepotType();
+        this.depotStatus = depot.getDepotStatus();
+    }
+
 }
diff --git a/igds-core/src/main/java/com/ld/igds/models/InoutConf.java b/igds-core/src/main/java/com/ld/igds/models/InoutConf.java
index c74a4d4..111a63c 100644
--- a/igds-core/src/main/java/com/ld/igds/models/InoutConf.java
+++ b/igds-core/src/main/java/com/ld/igds/models/InoutConf.java
@@ -78,10 +78,6 @@
     @PropertyDef(label = "鎺у埗绔彛")
     private Integer portCtrl;
 
-//	@Column(name = "PORT_WEB_")
-//	@PropertyDef(label = "WEB绔彛")
-//	private Integer portWeb;
-
     @Column(name = "TYPE_", length = 10)
     @PropertyDef(label = "璁惧绫诲瀷")
     private String type;
diff --git a/igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java b/igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java
index 0ee730e..4c5e2f3 100644
--- a/igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java
+++ b/igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java
@@ -430,7 +430,7 @@
         view.addObject(Constant.MODEL_KEY_DEPT_ID, iDept.getId());
 
         // 浠撳簱鍒楄〃
-        List<Depot> listDepot = commonManager.listDepotByDeptId(true, iDept.getId());
+        List<Depot> listDepot = commonManager.listDepotByDeptId(user.getCompanyId(), iDept.getId());
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         // 搴撳尯鍒楄〃
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
index f3f1ee1..709beec 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
@@ -9,11 +9,11 @@
 import com.ld.igds.data.BaseParam;
 import com.ld.igds.data.Page;
 import com.ld.igds.data.PageResponse;
+import com.ld.igds.data.SimpleDepot;
 import com.ld.igds.inout.InoutConstant;
 import com.ld.igds.inout.dto.*;
 import com.ld.igds.inout.manager.InoutCommonManager;
 import com.ld.igds.inout.manager.InoutManager;
-import com.ld.igds.io.dto.WeightDto;
 import com.ld.igds.models.Depot;
 import com.ld.igds.models.DicTrigger;
 import com.ld.igds.models.InoutConf;
@@ -171,7 +171,6 @@
         }
 
         ModelAndView view = new ModelAndView();
-
         IUser user = ContextUtil.getLoginUser();
         view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
 
@@ -181,59 +180,52 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         // 褰撳墠娴佺▼鏍囩
         view.addObject("progress", InoutConstant.PROGRESS_WEIGHT_TAG);
 
-        //鍏ュ簱娴佺▼
+        //鍏ュ簱娴佺▼閰嶇疆
         String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(), deptId, InoutConstant.TYPE_IN);
         view.addObject("inoutProgress", inoutProgress);
 
-        //绉伴噸缁撴灉鏄惁鍙慨鏀�
-        String weightEditTag = inoutCommonManager.getWeightEditTag(user.getCompanyId(), ContextUtil.subDeptId(user));
+        //绉伴噸鏄惁鍙紪杈戞爣绛�
+        String weightEditTag = inoutCommonManager.getWeightEditTag(user.getCompanyId(), deptId);
         view.addObject("weightEditTag", weightEditTag);
 
         // 绮鍝佺涓嬫媺妗�
         List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
         view.addObject("listFoodVariety", listFoodVariety);
 
-        // 鑾峰彇鍑哄叆搴撻厤缃俊鎭�
+        // 鑾峰彇鍑哄叆搴撹澶囬厤缃俊鎭�
         List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
 
-        //鑾峰彇鎵�鏈夌殑鍦扮鍒楄〃鐢ㄤ簬椤甸潰鐢ㄦ埛閫夋嫨
-        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
+        //鏍规嵁鍑哄叆搴撹澶囦俊鎭瓫閫夊湴纾呴厤缃俊鎭紝鎵�鏈夊湴纾咃紝鏀寔鐢ㄦ埛鎵嬪姩閫夋嫨
+        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
         view.addObject("listWeight", listWeight);
 
-        // 鑾峰彇褰撳墠鍦扮淇℃伅
-        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
+        // 鑾峰彇褰撳墠鍦扮
+        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
         view.addObject("weightDto", weightDto);
 
         // 杩囩▼鎽勫儚澶�1
-        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
-                InoutConstant.PROGRESS_WEIGHT_TAG, 1);
+        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 1);
         view.addObject("snapDto1", conf);
 
         // 杩囩▼鎽勫儚澶�2
-        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
-                InoutConstant.PROGRESS_WEIGHT_TAG, 2);
+        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 2);
         view.addObject("snapDto2", conf);
 
         // 杩囩▼鎽勫儚澶�3
-        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
-                InoutConstant.PROGRESS_WEIGHT_TAG, 3);
+        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 3);
         view.addObject("snapDto3", conf);
 
-        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_70,
-                InoutConstant.PROGRESS_WEIGHT_TAG, 1);
-
-        view.addObject("gateDto", conf);
-        // 鏅烘収鍗�
+        // 杩滅▼鏅烘収鍗�
         conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_80, InoutConstant.PROGRESS_WEIGHT_TAG, 1);
         if (null != conf) conf.setSort(sort);
-
         view.addObject("cardDto", conf);
+
 
         view.setViewName("admin/inout/in-weight");
         return view;
@@ -252,12 +244,13 @@
         IUser user = ContextUtil.getLoginUser();
         view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
 
+        String deptId = ContextUtil.subDeptId(user);
         view.addObject("bizType", BizType.INOUT_IN.getCode());
-        view.addObject("deptId", ContextUtil.subDeptId(user));
+        view.addObject("deptId", deptId);
         view.addObject("type", InoutConstant.TYPE_IN);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -294,12 +287,13 @@
         IUser user = ContextUtil.getLoginUser();
         view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
 
+        String deptId = ContextUtil.subDeptId(user);
         view.addObject("bizType", BizType.INOUT_IN.getCode());
-        view.addObject("deptId", ContextUtil.subDeptId(user));
+        view.addObject("deptId", deptId);
         view.addObject("type", InoutConstant.TYPE_IN);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -387,7 +381,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         // 褰撳墠娴佺▼鏍囩
@@ -409,11 +403,11 @@
         List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
 
         //鑾峰彇鎵�鏈夌殑鍦扮鍒楄〃鐢ㄤ簬椤甸潰鐢ㄦ埛閫夋嫨
-        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
+        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
         view.addObject("listWeight", listWeight);
 
         // 鑾峰彇褰撳墠鍦扮淇℃伅
-        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
+        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
         view.addObject("weightDto", weightDto);
 
         // 杩囩▼鎽勫儚澶�1
@@ -454,7 +448,7 @@
         view.addObject("type", InoutConstant.TYPE_OUT);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listOutDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍑哄簱娴佺▼
@@ -489,16 +483,20 @@
 
         ModelAndView view = new ModelAndView();
 
-        // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listOutDepot();
-        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
-
         IUser user = ContextUtil.getLoginUser();
+
+        String deptId =  ContextUtil.subDeptId(user);
         view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
         view.addObject("bizType", BizType.INOUT_OUT.getCode());
-        view.addObject("deptId", ContextUtil.subDeptId(user));
+        view.addObject("deptId",deptId);
         view.addObject("type", InoutConstant.TYPE_OUT);
 
+
+        // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
+        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
+
+
         //鍑哄簱娴佺▼
         String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(),
                 ContextUtil.subDeptId(user), InoutConstant.TYPE_OUT);
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController2.java b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController2.java
index 8c8298f..386c5de 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController2.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController2.java
@@ -7,6 +7,7 @@
 import com.ld.igds.constant.RespCodeEnum;
 import com.ld.igds.data.Page;
 import com.ld.igds.data.PageResponse;
+import com.ld.igds.data.SimpleDepot;
 import com.ld.igds.file.dto.FileData;
 import com.ld.igds.inout.InoutConstant;
 import com.ld.igds.inout.dto.InoutData;
@@ -28,6 +29,7 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.servlet.ModelAndView;
+
 import javax.annotation.Resource;
 import java.net.URLDecoder;
 import java.util.Date;
@@ -126,7 +128,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -202,7 +204,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listOutDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -338,7 +340,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         // 绮鍝佺涓嬫媺妗�
@@ -379,7 +381,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -410,11 +412,11 @@
                 .getCompanyId(), deptId);
 
         //鑾峰彇鎵�鏈夌殑鍦扮鍒楄〃鐢ㄤ簬椤甸潰鐢ㄦ埛閫夋嫨
-        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
+        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
         view.addObject("listWeight", listWeight);
 
         // 鑾峰彇褰撳墠鍦扮淇℃伅
-        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
+        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
         view.addObject("weightDto", weightDto);
 
         // 杩囩▼鎽勫儚澶�1
@@ -456,7 +458,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         // 绮鍝佺涓嬫媺妗�
@@ -495,7 +497,7 @@
         view.addObject("deptId", deptId);
 
         // 浠撳簱鍒楄〃鍋氫笅鎷夋浣跨敤
-        List<Depot> listDepot = commonManager.listInDepot();
+        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
         view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
 
         //鍏ュ簱娴佺▼
@@ -526,11 +528,11 @@
                 .getCompanyId(), deptId);
 
         //鑾峰彇鎵�鏈夌殑鍦扮鍒楄〃鐢ㄤ簬椤甸潰鐢ㄦ埛閫夋嫨
-        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
+        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
         view.addObject("listWeight", listWeight);
 
         // 鑾峰彇褰撳墠鍦扮淇℃伅
-        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
+        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
         view.addObject("weightDto", weightDto);
 
         // 杩囩▼鎽勫儚澶�1
diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java
index 7f9ade9..f1c5b38 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java
@@ -94,6 +94,33 @@
         return result;
     }
 
+    public List<InoutConf> getInoutConf(List<InoutConf> listInoutConf, String type) {
+        List<InoutConf> result = new ArrayList<>();
+        if (null == listInoutConf) return result;
+        for (InoutConf conf : listInoutConf) {
+            if (type.equals(conf.getType())) {
+                result.add(conf);
+            }
+        }
+        return result;
+    }
+
+    public InoutConf getInoutConf(List<InoutConf> listInoutConf, String sort,String type) {
+        if (null == listInoutConf) return new InoutConf(sort);
+        if (StringUtils.isEmpty(sort)) sort = "1";
+
+        InoutConf result = null;
+        for (InoutConf conf : listInoutConf) {
+            if (sort.equals(conf.getSort()) && type.equals(conf.getType())) {
+                return conf;
+            }
+        }
+
+        if (null == result) return new InoutConf(sort);
+
+        return result;
+    }
+
 
     /**
      * 鏍规嵁绫诲瀷鑾峰彇瀛楀吀琛ㄤ笅鎷夋
@@ -123,28 +150,6 @@
         return weightEditTag;
     }
 
-    public List<WeightDto> getInoutWeightAll(List<InoutConf> listInoutConf, String type) {
-        List<WeightDto> result = new ArrayList<>();
-        if (null == listInoutConf) return result;
-
-        for (InoutConf conf : listInoutConf) {
-            if (type.equals(conf.getType())) {
-                result.add(new WeightDto(conf));
-            }
-        }
-        return result;
-    }
-
-    public WeightDto getInoutCurWeight(List<WeightDto> listWeight, String sort) {
-        if (null == listWeight || listWeight.isEmpty()) return new WeightDto();
-
-        if (listWeight.size() == 1) return listWeight.get(0);
-
-        for (WeightDto weight : listWeight) {
-            if (weight.getSort().equals(sort)) return weight;
-        }
-        return new WeightDto();
-    }
 
 
     /**
diff --git a/igds-inout/src/main/java/com/ld/igds/io/dto/WeightDto.java b/igds-inout/src/main/java/com/ld/igds/io/dto/WeightDto.java
index 2c228a5..549c8b5 100644
--- a/igds-inout/src/main/java/com/ld/igds/io/dto/WeightDto.java
+++ b/igds-inout/src/main/java/com/ld/igds/io/dto/WeightDto.java
@@ -9,6 +9,8 @@
 /**
  * 鍦扮鍩轰俊鎭�
  *
+ * 2023骞�5鏈�31鏃� 13:57:15  鍙栨秷鑸嶅純浣跨敤锛屾敼鐢↖noutConf瀵硅薄鍜孉piInoutData
+ *
  * @author: andy.jia
  * @description:
  * @version:
diff --git a/igds-web/src/main/resources/static/admin/inout/in-weight.js b/igds-web/src/main/resources/static/admin/inout/in-weight.js
index e5e5e36..dc553ba 100644
--- a/igds-web/src/main/resources/static/admin/inout/in-weight.js
+++ b/igds-web/src/main/resources/static/admin/inout/in-weight.js
@@ -6,6 +6,7 @@
 var snapData;//绯荤粺鎶撴媿瀵硅薄淇℃伅
 var timerWeight;
 var textParam;//璁惧璇嗗埆缁撴灉
+var curProgress;//褰撳墠璇︾粏娴佺▼
 
 $(function () {
     layui.use(['layer', 'laydate', 'form', 'table', 'util'], function () {
@@ -49,8 +50,7 @@
 
     // 鐩戝惉閲嶉噺鍙樺寲
     $(".weight").blur(function () {
-        var name = this.name;
-        deAutoByIn(name);
+        deAutoByIn(this.name);
     });
 
     // 鍒濆鍖朩ebSocket
@@ -78,7 +78,6 @@
             updateWeight();
         });
     });
-
 };
 
 // socket淇℃伅杩斿洖铏曠悊
@@ -92,7 +91,6 @@
         $("#btn-submit").removeClass("layui-btn-disabled");
         $("#btn-submit").attr("disabled", false);
     }
-
     if ("btn-submit" == btnId) {
         $("#btn-submit").addClass("layui-btn-disabled");
         $("#btn-submit").attr("disabled", true);
@@ -105,8 +103,6 @@
 
             $("#btn-printBill").removeClass("layui-btn-disabled");
             $("#btn-printBill").attr("disabled", false);
-
-            addDisabled();
         }
     }
     if ("btn-printBill" == btnId) {// 鎵撳嵃杩囩鍗曪紝璇存槑涓氬姟瀹屾垚
@@ -119,44 +115,15 @@
         $("#btn-printBill").addClass("layui-btn-disabled");
         $("#btn-printBill").attr("disabled", true);
 
-        delDisabled();
         resetForm();
     }
 }
 
-//鏇存敼鎵i噸淇℃伅妗嗕笉鍙紪杈�
-function addDisabled() {
-    //鏉傝川
-    $("#impurity").attr("disabled", true);
-    $("#deImpurity").attr("disabled", true);
-    //姘村垎
-    $("#wet").attr("disabled", true);
-    $("#deWet").attr("disabled", true);
-    //鍊间粨
-    $("#deHandle").attr("disabled", true);
-    //鍏朵粬
-    $("#deOther").attr("disabled", true);
-}
-
-//鎭㈠鎵i噸淇℃伅妗嗙紪杈戠姸鎬�
-function delDisabled() {
-    //鏉傝川
-    $("#impurity").attr("disabled", false);
-    $("#deImpurity").attr("disabled", false);
-    //姘村垎
-    $("#wet").attr("disabled", false);
-    $("#deWet").attr("disabled", false);
-    //鍊间粨
-    $("#deHandle").attr("disabled", false);
-    //鍏朵粬
-    $("#deOther").attr("disabled", false);
-}
-
-// 鐐瑰嚮绉伴噸
+//鐐瑰嚮绉伴噸
 function weight() {
     // 娌℃湁涓氬姟鏁版嵁涓嶅彲鎵ц
     if (!recordData) {
-        layer.alert("娌℃湁鏌ヨ鍒颁笟鍔℃暟鎹紝鎵ц琚嫆缁濓紒锛�");
+        alertError("娌℃湁鏌ヨ鍒颁笟鍔℃暟鎹紝鎵ц琚嫆缁濓紒锛�");
         return;
     }
 
@@ -224,7 +191,7 @@
 
 //鏂扮殑璇诲崱鏂瑰紡
 function flushICCard() {
-	flushICCard1();
+    flushICCard1();
 }
 
 /**
@@ -283,7 +250,7 @@
         success: function (json) {
             var data = json.no;
             if (data === "not found") {
-            	alertError("璇烽噸鏂拌鍗★紒");
+                alertError("璇烽噸鏂拌鍗★紒");
             } else {
                 textParam = data;
                 $("#text-param").text("璇嗗埆鍗″彿锛�" + textParam);
@@ -291,7 +258,7 @@
             }
         },
         error: function () {
-        	alertError("IC鍗¤鍙栧嚭閿欙紒");
+            alertError("IC鍗¤鍙栧嚭閿欙紒");
         }
     });
 }
diff --git a/igds-web/src/main/resources/templates/admin/inout/in-weight.html b/igds-web/src/main/resources/templates/admin/inout/in-weight.html
index 6b5511d..640a2c9 100644
--- a/igds-web/src/main/resources/templates/admin/inout/in-weight.html
+++ b/igds-web/src/main/resources/templates/admin/inout/in-weight.html
@@ -702,19 +702,14 @@
     var weightEditTag = [[${weightEditTag}]];
     //userId
     var userId = [[${loginUser.username}]];
-
     //鍑哄叆搴撶被鍨�
     var type = [[${type}]];
-
     var companyId = [[${loginUser.companyId}]];
     //鍝佺
     var listFoodVariety = [[${listFoodVariety}]];
 
     //鍦扮淇℃伅
     var weightDto = [[${weightDto}]];
-
-    //杞︾墝璇嗗埆淇℃伅
-    //var lprDto = [[${lprDto}]];
 
     //杩囩▼鎽勫儚澶�
     var snapDto1 = [[${snapDto1}]];

--
Gitblit v1.9.3