From 21bf8b454eee7e80d9471e4424e7520c4f82f3a7 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期二, 25 七月 2023 11:55:14 +0800
Subject: [PATCH] 通知单及合同相关优化

---
 igds-inout/src/main/java/com/ld/igds/m/view/ContractManage.view.xml     |   19 +++
 igds-inout/src/main/java/models/inout.model.xml                         |   20 +++
 igds-inout/src/main/java/com/ld/igds/inout/view/InoutHand.view.xml      |   27 ++++
 igds-inout/src/main/java/com/ld/igds/m/service/HInoutNoticeService.java |   29 ++--
 igds-inout/src/main/java/com/ld/igds/m/view/InoutCustomerPR.java        |  123 +++++++++++--------
 igds-inout/src/main/java/com/ld/igds/m/dto/NoticeDto.java               |  142 ++++++++++++-----------
 6 files changed, 222 insertions(+), 138 deletions(-)

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 bf6cbc1..dd23a2f 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
@@ -862,7 +862,7 @@
     <CustomDropDown id="ddNotice">
       <Property name="minHeight">400</Property>
       <Property name="assignmentMap">noticeId=id,customerName=customerName</Property>
-      <Property name="minWidth">500</Property>
+      <Property name="minWidth">1000</Property>
       <Property name="autoOpen">true</Property>
       <Container layout="regionPadding:5">
         <DataSet id="dsNotice">
@@ -902,13 +902,34 @@
 }</ClientEvent>
           <Property name="dataSet">dsNotice</Property>
           <Property name="readOnly">true</Property>
+          <DataColumn name="name">
+            <Property name="property">name</Property>
+            <Property name="align">center</Property>
+            <Property name="width">100</Property>
+          </DataColumn>
           <DataColumn>
             <Property name="property">customerName</Property>
             <Property name="align">center</Property>
             <Property name="name">customerName</Property>
+            <Property name="width">240</Property>
           </DataColumn>
-          <DataColumn name="name">
-            <Property name="property">name</Property>
+          <DataColumn name="foodVariety">
+            <Property name="property">foodVariety</Property>
+            <Property name="align">center</Property>
+          </DataColumn>
+          <DataColumn name="year">
+            <Property name="property">year</Property>
+            <Property name="align">center</Property>
+          </DataColumn>
+          <DataColumn name="depotId">
+            <Property name="property">depotId</Property>
+            <Property name="align">center</Property>
+            <Property name="width">180</Property>
+          </DataColumn>
+          <DataColumn name="contractName">
+            <Property name="property">contractName</Property>
+            <Property name="align">center</Property>
+            <Property name="width">300</Property>
           </DataColumn>
         </DataGrid>
       </Container>
diff --git a/igds-inout/src/main/java/com/ld/igds/m/dto/NoticeDto.java b/igds-inout/src/main/java/com/ld/igds/m/dto/NoticeDto.java
index 18d3258..c8ee446 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/dto/NoticeDto.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/dto/NoticeDto.java
@@ -1,6 +1,7 @@
 package com.ld.igds.m.dto;
 
 import lombok.Data;
+
 import java.util.Date;
 
 /**
@@ -9,77 +10,82 @@
  * @author chen
  */
 @Data
-public class NoticeDto{
+public class NoticeDto {
 
 
-	/**
-	 * 閫氱煡鍗昳d
-	 */
-	private String id;
+    /**
+     * 閫氱煡鍗昳d
+     */
+    private String id;
 
+
+    private String name;
+
+    /**
+     * 缁勭粐缂栫爜
+     */
+    private String companyId;
+
+    /**
+     * 搴撳尯缂栫爜
+     */
+    private String deptId;
+
+    /**
+     * 浠撳簱缂栫爜
+     */
+    private String depotId;
+
+    /**
+     * 瀹㈡埛缂栫爜
+     */
+    private String customerId;
+
+    /**
+     * 瀹㈡埛鍚嶇О
+     */
+    private String customerName;
+
+    /**
+     * 鍗曚綅鍚嶇О
+     */
+    private String unitName;
+
+    /**
+     * 绮鍝佺
+     */
+    private String foodVariety;
+
+
+    /**
+     * 绮鎬ц川
+     */
+    private String foodType;
+
+
+    /**
+     * 骞翠唤
+     */
+    private String year;
+
+    /**
+     * 鐩爣鏁伴噺
+     */
+    private double targetNumber = 0.0;
+
+    /**
+     * 瀹屾垚鏁伴噺
+     */
+    private double completeNumber = 0.0;
+
+    /**
+     * 瀹屾垚鏃堕棿
+     */
+    private Date completeTime;
 	
-	private String name;
-
-	/**
-	 * 缁勭粐缂栫爜
-	 */
-	private String companyId;
-
-	/**
-	 * 搴撳尯缂栫爜
-	 */
-	private String deptId;
-
-	/**
-	 * 浠撳簱缂栫爜
-	 */
-	private String depotId;
-
-	/**
-	 * 瀹㈡埛缂栫爜
-	 */
-	private String customerId;
-
-	/**
-	 * 瀹㈡埛鍚嶇О
-	 */
-	private String customerName;
-
-	/**
-	 * 鍗曚綅鍚嶇О
-	 */
-	private String unitName;
-
-	/**
-	 * 绮鍝佺
-	 */
-	private String foodVariety;
-	
-
-	/**
-	 * 绮鎬ц川
-	 */
-	private String foodType;
-
-
-	/**
-	 * 骞翠唤
-	 */
-	private String year;
-
-	/**
-	 * 鐩爣鏁伴噺
-	 */
-	private double targetNumber = 0.0;
-
-	/**
-	 * 瀹屾垚鏁伴噺
-	 */
-	private double completeNumber = 0.0;
-
-	/**
-	 * 瀹屾垚鏃堕棿
-	 */
-	private Date completeTime;
+    /**
+     * 鎵�灞炲悎鍚�
+     */
+    private String contractName;
 
 }
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..21f6ab5 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
@@ -96,11 +97,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);
@@ -213,11 +214,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 +258,7 @@
 
     /**
      * 鏍规嵁鍙傛暟鏌ヨ鍑哄叆搴撻�氱煡鍗�
+     *
      * @param parameter
      * @return
      */
@@ -271,15 +273,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 +294,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";
@@ -311,13 +313,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 +327,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 +353,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();
diff --git a/igds-inout/src/main/java/com/ld/igds/m/view/ContractManage.view.xml b/igds-inout/src/main/java/com/ld/igds/m/view/ContractManage.view.xml
index f711c52..57fc926 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/view/ContractManage.view.xml
+++ b/igds-inout/src/main/java/com/ld/igds/m/view/ContractManage.view.xml
@@ -39,6 +39,9 @@
       </PropertyDef>
     </DataType>
     <DataType name="dtMain">
+      <ClientEvent name="onDataChange">if(arg.property ==&quot;customerId&quot;){&#xD;
+	autoByCustomer(arg.newValue);&#xD;
+}</ClientEvent>
       <Property name="creationType">com.ld.igds.models.InoutContract</Property>
       <PropertyDef name="id">
         <Property></Property>
@@ -371,7 +374,18 @@
   </Model>
   <View layout="regionPadding:10">
     <ClientEvent name="onReady">var deptId = window.parent.deptId;//鐖堕〉闈腑鐨勫垎搴撶紪鐮�&#xD;
-&#xD;
+//鏍规嵁瀹㈡埛鑷姩鍥炲~瀹㈡埛绫诲瀷锛屽鎴峰紑鎴疯锛屽鎴峰紑鎴疯璐﹀彿锛屽鎴风绾︿汉&#xD;
+autoByCustomer = function(id){&#xD;
+   view.get(&quot;#ajaxGetCustomer&quot;).set(&quot;parameter&quot;,id).execute(function(result){&#xD;
+     if(result){&#xD;
+     var data = view.get(&quot;#dsMain.data:#&quot;);&#xD;
+     data.set(&quot;customerType&quot;,result.khlx);&#xD;
+	 data.set(&quot;customerBank&quot;,result.bank);&#xD;
+     data.set(&quot;customerBankAccount&quot;,result.bankNum);&#xD;
+     data.set(&quot;customerSignUser&quot;,result.fddbr);&#xD;
+	}&#xD;
+});&#xD;
+};&#xD;
 addMain = function(){&#xD;
 	view.get(&quot;#dsMain&quot;).insert({});&#xD;
 	view.get(&quot;#dialogMain&quot;).show();&#xD;
@@ -760,6 +774,9 @@
       <Property name="confirmMessage">纭畾瑕佸垹闄ゅ悧锛�</Property>
       <Property name="service">contractManagePR#delContract</Property>
     </AjaxAction>
+    <AjaxAction id="ajaxGetCustomer">
+      <Property name="service">inoutCustomerPR#queryListByParam</Property>
+    </AjaxAction>
     <CustomDropDown id="ddCustomer">
       <Property name="minHeight">400</Property>
       <Property name="assignmentMap">customerId=id,customerName=name</Property>
diff --git a/igds-inout/src/main/java/com/ld/igds/m/view/InoutCustomerPR.java b/igds-inout/src/main/java/com/ld/igds/m/view/InoutCustomerPR.java
index 5dec2b4..5a0a4ea 100644
--- a/igds-inout/src/main/java/com/ld/igds/m/view/InoutCustomerPR.java
+++ b/igds-inout/src/main/java/com/ld/igds/m/view/InoutCustomerPR.java
@@ -2,6 +2,7 @@
 
 import java.text.Collator;
 import java.util.*;
+
 import com.ld.igds.m.service.HInoutCustomerService;
 import com.ld.igds.models.InoutCustomer;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -11,71 +12,87 @@
 
 /**
  * 鍑哄叆搴�-寰�鏉ュ崟浣嶇鐞�
- * 
+ *
  * @author: andy.jia
  * @description:
  * @version:
  * @data:2020骞�3鏈�12鏃�
- *
  */
 @Component("inoutCustomerPR")
 public class InoutCustomerPR {
 
-	@Autowired
-	private HInoutCustomerService customerService;
+    @Autowired
+    private HInoutCustomerService customerService;
 
-	/**
-	 * inoutCustomerPR#queryList 鑾峰彇鎵�鏈変俊鎭�
-	 * 
-	 * @param parameter
-	 * @return
-	 */
-	@DataProvider
-	public List<InoutCustomer> queryList(Map<String, Object> parameter) {
+    /**
+     * inoutCustomerPR#queryList 鑾峰彇鎵�鏈変俊鎭�
+     *
+     * @param parameter
+     * @return
+     */
+    @DataProvider
+    public List<InoutCustomer> queryList(Map<String, Object> parameter) {
 
-		List<InoutCustomer> list = customerService.queryList(parameter);
-		Collections.sort(list, new Comparator<InoutCustomer>() {
-			@Override
-			public int compare(InoutCustomer a1, InoutCustomer a2) {
-				return Collator.getInstance(Locale.CHINESE).compare(a1.getName(),a2.getName());
-			}
-		});
-		return list;
+        List<InoutCustomer> list = customerService.queryList(parameter);
+        Collections.sort(list, new Comparator<InoutCustomer>() {
+            @Override
+            public int compare(InoutCustomer a1, InoutCustomer a2) {
+                return Collator.getInstance(Locale.CHINESE).compare(a1.getName(), a2.getName());
+            }
+        });
+        return list;
 
-	}
+    }
 
-	/**
-	 * inoutCustomerPR#queryListByKey
-	 * 鏍规嵁鍏抽敭瀛楁煡璇紝鍙兘鏄疘D鍙兘鏄悕绉�
-	 * 
-	 * @param
-	 * @return
-	 */
-	@DataProvider
-	public List<InoutCustomer> queryListByKey(Map<String, Object> param) {
-		List<InoutCustomer> list = customerService.queryList(param);
-		Collections.sort(list, new Comparator<InoutCustomer>() {
-			@Override
-			public int compare(InoutCustomer a1, InoutCustomer a2) {
-				return Collator.getInstance(Locale.CHINESE).compare(a1.getName(),a2.getName());
-			}
-		});
-		return list;
-	}
+    /**
+     * inoutCustomerPR#queryListByKey
+     * 鏍规嵁鍏抽敭瀛楁煡璇紝鍙兘鏄疘D鍙兘鏄悕绉�
+     *
+     * @param
+     * @return
+     */
+    @DataProvider
+    public List<InoutCustomer> queryListByKey(Map<String, Object> param) {
+        List<InoutCustomer> list = customerService.queryList(param);
+        Collections.sort(list, new Comparator<InoutCustomer>() {
+            @Override
+            public int compare(InoutCustomer a1, InoutCustomer a2) {
+                return Collator.getInstance(Locale.CHINESE).compare(a1.getName(), a2.getName());
+            }
+        });
+        return list;
+    }
 
-	/**
-	 * inoutCustomerPR#saveData
-	 */
-	@Expose
-	public String saveData(InoutCustomer data) {
-		return customerService.saveOrUpdateData(data);
-	}
+    /**
+     * inoutCustomerPR#saveData
+     */
+    @Expose
+    public String saveData(InoutCustomer data) {
+        return customerService.saveOrUpdateData(data);
+    }
 
-	/**
-	 * inoutCustomerPR#delData
-	 */
-	@Expose
-	public String delData(InoutCustomer data) {
-		return customerService.delData(data);
-	}
+    /**
+     * inoutCustomerPR#delData
+     */
+    @Expose
+    public String delData(InoutCustomer data) {
+        return customerService.delData(data);
+    }
+
+
+    /**
+     * inoutCustomerPR#queryListByParam
+     * 鏍规嵁鍏抽敭瀛楁煡璇紝ID
+     *
+     * @param
+     * @return
+     */
+    @Expose
+    public InoutCustomer queryListByParam(String id) {
+        Map<String, Object> param = new HashMap<>();
+        param.put("id", id);
+        List<InoutCustomer> list = customerService.queryList(param);
+
+        return list.get(0);
+    }
 }
diff --git a/igds-inout/src/main/java/models/inout.model.xml b/igds-inout/src/main/java/models/inout.model.xml
index a4a2461..f4c8009 100644
--- a/igds-inout/src/main/java/models/inout.model.xml
+++ b/igds-inout/src/main/java/models/inout.model.xml
@@ -554,6 +554,12 @@
     </PropertyDef>
     <PropertyDef name="depotId">
       <Property></Property>
+      <Property name="label">鎵�娑変粨搴�</Property>
+      <Property name="mapping">
+        <Property name="mapValues">${dorado.getDataProvider(&quot;depotPR#getAllCache&quot;).getResult()}</Property>
+        <Property name="keyProperty">id</Property>
+        <Property name="valueProperty">name</Property>
+      </Property>
     </PropertyDef>
     <PropertyDef name="customerId">
       <Property></Property>
@@ -564,12 +570,19 @@
     </PropertyDef>
     <PropertyDef name="foodVariety">
       <Property></Property>
+      <Property name="mapping">
+        <Property name="mapValues">${dorado.getDataProvider(&quot;dicTriggerPR#dicTrigger&quot;).getResult(&quot;FOOD_VARIETY_&quot;)}</Property>
+        <Property name="keyProperty">code</Property>
+        <Property name="valueProperty">name</Property>
+      </Property>
+      <Property name="label">绮鍝佺</Property>
     </PropertyDef>
     <PropertyDef name="foodType">
       <Property></Property>
     </PropertyDef>
     <PropertyDef name="year">
       <Property></Property>
+      <Property name="label">骞翠唤</Property>
     </PropertyDef>
     <PropertyDef name="targetNumber">
       <Property name="dataType">double</Property>
@@ -580,5 +593,12 @@
     <PropertyDef name="completeTime">
       <Property name="dataType">Date</Property>
     </PropertyDef>
+    <PropertyDef name="unitName">
+      <Property/>
+    </PropertyDef>
+    <PropertyDef name="contractName">
+      <Property/>
+      <Property name="label">鎵�灞炲悎鍚�</Property>
+    </PropertyDef>
   </DataType>
 </Model>

--
Gitblit v1.9.3