From 69cd9f59a0fabf12f8c9147fcba7f69817a870b3 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期一, 06 十一月 2023 23:40:59 +0800
Subject: [PATCH] 更新仓内抓拍2

---
 igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java |   53 +++++++++++++++++++++++------------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java b/igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java
index cd2312f..293b6fe 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java
@@ -15,6 +15,7 @@
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
+
 import java.util.*;
 
 @Repository
@@ -26,23 +27,18 @@
     public void pageQueryIn(Page<InoutNoticeIn> page, Map<String, Object> param) throws Exception {
 
         String hql = " from " + InoutNoticeIn.class.getName()
-                + " where companyId =:companyId";
+                + " where companyId =:companyId and deptId =:deptId";
 
         Map<String, Object> args = new HashMap<String, Object>();
         args.put("companyId", ContextUtil.getCompanyId());
+        args.put("deptId", ContextUtil.subDeptId(null));
 
         Object year = param.get("year");
         if (year == null) {
             param.put("year", DateFormatUtils.format(new Date(), "yyyy"));
         }
 
-        String str = (String) param.get("deptId");
-        if (StringUtils.isNotEmpty(str)) {
-            hql += " and deptId =:deptId";
-            args.put("deptId", str);
-        }
-
-        str = (String) param.get("id");
+        String str = (String) param.get("id");
         if (StringUtils.isNotEmpty(str)) {
             hql += " and id=:id";
             args.put("id", str);
@@ -96,11 +92,11 @@
             param.setFoodVariety(data.getFoodVariety());
             param.setYear(data.getYear());
             //鑻ユ湁鍚堝悓淇℃伅锛屾坊鍔犲悎鍚屼俊鎭�
-            if(StringUtils.isNotEmpty(data.getContractId())){
+            if (StringUtils.isNotEmpty(data.getContractId())) {
                 param.setContractId(data.getContractId());
             }
             //鑻ユ湁璁″垝淇℃伅锛屾坊鍔犺鍒掍俊鎭�
-            if(StringUtils.isNotEmpty(data.getPlanId())){
+            if (StringUtils.isNotEmpty(data.getPlanId())) {
                 param.setPlanId(data.getPlanId());
             }
             param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE);
@@ -142,23 +138,18 @@
     public void pageQueryOut(Page<InoutNoticeOut> page, Map<String, Object> param) throws Exception {
 
         String hql = " from " + InoutNoticeOut.class.getName()
-                + " where companyId =:companyId";
+                + " where companyId =:companyId and deptId =:deptId";
 
         Map<String, Object> args = new HashMap<String, Object>();
         args.put("companyId", ContextUtil.getCompanyId());
+        args.put("deptId", ContextUtil.subDeptId(null));
 
         Object year = param.get("year");
         if (year == null) {
             param.put("year", DateFormatUtils.format(new Date(), "yyyy"));
         }
 
-        String str = (String) param.get("deptId");
-        if (StringUtils.isNotEmpty(str)) {
-            hql += " and deptId =:deptId";
-            args.put("deptId", str);
-        }
-
-        str = (String) param.get("id");
+        String str = (String) param.get("id");
         if (StringUtils.isNotEmpty(str)) {
             hql += " and id =:id";
             args.put("id", str);
@@ -213,11 +204,11 @@
             param.setFoodVariety(data.getFoodVariety());
             param.setYear(data.getYear());
             //鑻ユ湁鍚堝悓淇℃伅锛屾坊鍔犲悎鍚屼俊鎭�
-            if(StringUtils.isNotEmpty(data.getContractId())){
+            if (StringUtils.isNotEmpty(data.getContractId())) {
                 param.setContractId(data.getContractId());
             }
             //鑻ユ湁璁″垝淇℃伅锛屾坊鍔犺鍒掍俊鎭�
-            if(StringUtils.isNotEmpty(data.getPlanId())){
+            if (StringUtils.isNotEmpty(data.getPlanId())) {
                 param.setPlanId(data.getPlanId());
             }
             param.setCompleteStatus(InoutConstant.COMPLETE_STATUS_NONE);
@@ -257,6 +248,7 @@
 
     /**
      * 鏍规嵁鍙傛暟鏌ヨ鍑哄叆搴撻�氱煡鍗�
+     *
      * @param parameter
      * @return
      */
@@ -271,15 +263,15 @@
         String hql = " from ";
         if (InoutConstant.TYPE_IN.equals(type)) {
             hql += InoutNoticeIn.class.getName();
-        }else {
+        } else {
             hql += InoutNoticeOut.class.getName();
         }
-        hql += " where companyId =:companyId and deptId =:deptId";
+        hql += " where companyId =:companyId and deptId =:deptId and completeStatus =:completeStatus";
 
         Map<String, Object> args = new HashMap<>();
         args.put("companyId", ContextUtil.getCompanyId());
         args.put("deptId", ContextUtil.subDeptId(null));
-
+        args.put("completeStatus", "NONE");
         String str = (String) parameter.get("customerId");
         if (StringUtils.isNotEmpty(str)) {
             hql += " and customerId =:customerId";
@@ -292,7 +284,7 @@
             args.put("foodVariety", str);
         }
 
-        if(InoutConstant.TYPE_OUT.equals(type)){
+        if (InoutConstant.TYPE_OUT.equals(type)) {
             str = (String) parameter.get("depotId");
             if (StringUtils.isNotEmpty(str)) {
                 hql += " and depotId =:depotId";
@@ -301,7 +293,7 @@
         }
 
         str = (String) parameter.get("key");
-        if (StringUtils.isNoneEmpty(str)) {
+        if (StringUtils.isNotEmpty(str)) {
             hql += " and (name like:name or customerName like:customerName) ";
             args.put("name", "%" + str + "%");
             args.put("customerName", "%" + str + "%");
@@ -311,13 +303,13 @@
 
         List<Object> list1 = this.query(hql, args);
         List<NoticeDto> list = new ArrayList<>();
-        if(list1 == null || list1.isEmpty()){
+        if (list1 == null || list1.isEmpty()) {
             return null;
         }
         NoticeDto dto;
         for (Object o : list1) {
             dto = new NoticeDto();
-            BeanUtils.copyProperties(o,dto);
+            BeanUtils.copyProperties(o, dto);
             list.add(dto);
         }
         return list;
@@ -325,19 +317,20 @@
 
     /**
      * 鏍规嵁id鑾峰彇閫氱煡鍗曚俊鎭�
+     *
      * @param id
      * @param type
      * @return
      */
     public NoticeDto queryNoticeById(String id, String type) {
 
-        if(StringUtils.isEmpty(id) || StringUtils.isEmpty(type)){
+        if (StringUtils.isEmpty(id) || StringUtils.isEmpty(type)) {
             return null;
         }
         String hql = " from ";
         if (InoutConstant.TYPE_IN.equals(type)) {
             hql += InoutNoticeIn.class.getName();
-        }else {
+        } else {
             hql += InoutNoticeOut.class.getName();
         }
         hql += " where companyId =:companyId and deptId =:deptId and id =:id";
@@ -350,7 +343,7 @@
         hql += " order by id ";
 
         List<Object> list = this.query(hql, args);
-        if(list == null || list.isEmpty()){
+        if (list == null || list.isEmpty()) {
             return null;
         }
         NoticeDto dto = new NoticeDto();

--
Gitblit v1.9.3