Browse Source

Merge branch 'dev' of depot-qinghai/depot-qualitycheck-qinghai into master

gdd 3 months ago
parent
commit
83c6727c9d

+ 39 - 0
src/main/java/com/chinaitop/depot/storage/controller/ClearanceConfirmationController.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.storage.controller;
2 2
 
3 3
 
4
+import com.chinaitop.depot.storage.model.StorageStorehouseBusiness;
4 5
 import com.github.pagehelper.PageHelper;
5 6
 import com.chinaitop.depot.storage.model.ClearanceConfirmation;
6 7
 import com.chinaitop.depot.storage.service.ClearanceConfirmationService;
@@ -161,6 +162,44 @@ public class ClearanceConfirmationController {
161 162
     }
162 163
 
163 164
 
165
+    /**
166
+     * 查询当前库区库存实物为空仓的仓房
167
+     *
168
+     * @param orgId
169
+     * @return
170
+     */
171
+    @RequestMapping(value = "/findStorehouse",produces = MediaType.APPLICATION_JSON_VALUE,method = RequestMethod.GET)
172
+    public List<StorageStorehouseBusiness> findStorehouse(Integer orgId) {
173
+        List<StorageStorehouseBusiness> storageStorehouseBusinessList = null;
174
+        try {
175
+
176
+            storageStorehouseBusinessList = clearanceConfirmationService.findStorehouse(orgId);
177
+
178
+        } catch (Exception e) {
179
+            e.printStackTrace();
180
+        }
181
+        return storageStorehouseBusinessList;
182
+    }
183
+
184
+    /**
185
+     * 查询当前库区库存实物为空仓的仓房
186
+     *
187
+     * @param storehouseId
188
+     * @return
189
+     */
190
+    @RequestMapping(value = "/findByWarehouse",produces = MediaType.APPLICATION_JSON_VALUE,method = RequestMethod.GET)
191
+    public List<StorageStorehouseBusiness> findByWarehouse(Integer storehouseId) {
192
+        List<StorageStorehouseBusiness> storageStorehouseBusinessList = null;
193
+        try {
194
+
195
+            storageStorehouseBusinessList = clearanceConfirmationService.findByWarehouse(storehouseId);
196
+
197
+        } catch (Exception e) {
198
+            e.printStackTrace();
199
+        }
200
+        return storageStorehouseBusinessList;
201
+    }
202
+
164 203
     
165 204
 
166 205
 }

+ 11 - 1
src/main/java/com/chinaitop/depot/storage/mapper/ClearanceConfirmationMapper.java

@@ -1,6 +1,9 @@
1 1
 package com.chinaitop.depot.storage.mapper;
2 2
 
3 3
 import com.chinaitop.depot.storage.model.ClearanceConfirmation;
4
+import com.chinaitop.depot.storage.model.StorageStorehouseBusiness;
5
+import com.chinaitop.depot.storage.model.WarehouseSealingRecord;
6
+import org.apache.ibatis.annotations.Param;
4 7
 import org.springframework.stereotype.Repository;
5 8
 
6 9
 import java.math.BigDecimal;
@@ -28,5 +31,12 @@ public interface ClearanceConfirmationMapper {
28 31
 
29 32
     Map<String, BigDecimal> getexcessLossQuantity(Integer warehouseId);
30 33
 
31
-    Map<String, Object> getStoreHouse(Integer warehouseId);
34
+    Map<String, Object> getStoreHouse(@Param("warehouseId")Integer warehouseId);
35
+
36
+
37
+    List<StorageStorehouseBusiness> findStorehouseList(@Param("orgId") Integer orgId);
38
+
39
+    List<StorageStorehouseBusiness> findByWarehouseList(@Param("storehouseId")Integer storehouseId);
40
+
41
+    ClearanceConfirmation selectByCqqrd(String warehouseId);
32 42
 }

+ 27 - 0
src/main/java/com/chinaitop/depot/storage/mapper/ClearanceConfirmationMapper.xml

@@ -231,4 +231,31 @@ cc.updatename updatename,cc.updatedate updatedate,cc.warehouse_id
231 231
     warehouse_id = #{warehouseId,jdbcType=INTEGER}
232 232
   where id = #{id,jdbcType=INTEGER}
233 233
   </update>
234
+  <select id="findStorehouseList" parameterType="java.lang.Integer" resultType="com.chinaitop.depot.storage.model.StorageStorehouseBusiness">
235
+    SELECT DISTINCT
236
+      bs.storehouse_id storehouseId,
237
+      bs.storehouse_name storehouseName
238
+    FROM
239
+      depot_qh.basic_storehouse bs
240
+        LEFT JOIN data_kcgl_kcsw_default dkkd ON bs.storehouse_id = dkkd.ch
241
+        LEFT JOIN 	depot_qh.basic_warehouse bw on bw.storehouse_id =bs.storehouse_id
242
+
243
+    where bs.org_id=#{orgId} and dkkd.ch is null and bw.storehouse_id is not null
244
+  </select>
245
+  <select id="findByWarehouseList" parameterType="java.lang.Integer" resultType="com.chinaitop.depot.storage.model.StorageStorehouseBusiness">
246
+
247
+    select DISTINCT bw.warehouse_id warehouseId,bw.warehouse_name warehouseName
248
+    from
249
+      depot_qh.basic_warehouse bw
250
+
251
+    where bw.storehouse_id=#{storehouseId}
252
+
253
+  </select>
254
+
255
+  <select id="selectByCqqrd" resultType="com.chinaitop.depot.storage.model.ClearanceConfirmation">
256
+    select cqqrdh from warehouse_sealing_record
257
+    where warehouse_id=#{warehouseId}
258
+    order by id desc
259
+      limit 1
260
+  </select>
234 261
 </mapper>

+ 6 - 4
src/main/java/com/chinaitop/depot/storage/mapper/WarehouseSealingRecordMapper.xml

@@ -219,10 +219,12 @@
219 219
       bw.warehouse_id warehouseId,
220 220
       bw.aisle_id ajid,
221 221
       bua.ajmc
222
-    from data_kcgl_kcsw_default kc
223
-           LEFT JOIN  basic_warehouse bw on kc.hwh = bw.warehouse_id and  bw.del_flag=1
224
-           LEFT JOIN basic_unit_aisle bua ON bw.aisle_id = bua.id
225
-    WHERE
222
+    from 	depot_qh.business_qc_quality_inspection bqqi
223
+              LEFT JOIN  depot_qh.basic_warehouse bw on bqqi.warehouse_id = bw.warehouse_id and  bw.del_flag=1
224
+              LEFT JOIN depot_qh.data_kcgl_kcsw_default kc on bqqi.warehouse_id= kc.hwh
225
+              LEFT JOIN depot_qh.basic_unit_aisle bua ON bw.aisle_id = bua.id
226
+
227
+    WHERE bqqi.jylb='01' and
226 228
      bw.storehouse_id=#{storehouseId}
227 229
   </select>
228 230
   <select id="findkcsw"  parameterType="java.lang.Integer" resultType="com.chinaitop.depot.storage.model.vo.kcswVO">

+ 4 - 0
src/main/java/com/chinaitop/depot/storage/service/ClearanceConfirmationService.java

@@ -2,6 +2,7 @@ package com.chinaitop.depot.storage.service;
2 2
 
3 3
 
4 4
 import com.chinaitop.depot.storage.model.ClearanceConfirmation;
5
+import com.chinaitop.depot.storage.model.StorageStorehouseBusiness;
5 6
 
6 7
 import javax.servlet.http.HttpServletRequest;
7 8
 import java.util.List;
@@ -35,4 +36,7 @@ public interface ClearanceConfirmationService {
35 36
     public void updateBasicStorehouse(ClearanceConfirmation ClearanceConfirmation);
36 37
 
37 38
 
39
+    List<StorageStorehouseBusiness> findStorehouse(Integer orgId);
40
+
41
+    List<StorageStorehouseBusiness> findByWarehouse(Integer storehouseId);
38 42
 }

+ 82 - 2
src/main/java/com/chinaitop/depot/storage/service/impl/ClearanceConfirmationServiceImpl.java

@@ -3,7 +3,11 @@ package com.chinaitop.depot.storage.service.impl;
3 3
 import com.alibaba.fastjson.JSONObject;
4 4
 
5 5
 import com.chinaitop.depot.storage.mapper.ClearanceConfirmationMapper;
6
+import com.chinaitop.depot.storage.mapper.WarehouseSealingRecordMapper;
6 7
 import com.chinaitop.depot.storage.model.ClearanceConfirmation;
8
+import com.chinaitop.depot.storage.model.StorageStorehouseBusiness;
9
+import com.chinaitop.depot.storage.model.WarehouseSealingRecord;
10
+import com.chinaitop.depot.storage.model.vo.WareHouseVO;
7 11
 import com.chinaitop.depot.storage.service.ClearanceConfirmationService;
8 12
 import com.fasterxml.jackson.databind.ObjectMapper;
9 13
 import com.sun.javafx.collections.MappingChange;
@@ -12,6 +16,8 @@ import org.springframework.stereotype.Service;
12 16
 
13 17
 import javax.annotation.Resource;
14 18
 import javax.servlet.http.HttpServletRequest;
19
+import java.time.LocalDate;
20
+import java.time.format.DateTimeFormatter;
15 21
 import java.util.Date;
16 22
 import java.util.HashMap;
17 23
 import java.util.List;
@@ -25,8 +31,8 @@ public class ClearanceConfirmationServiceImpl implements ClearanceConfirmationSe
25 31
     @Resource
26 32
     private ClearanceConfirmationMapper ClearanceConfirmationMapper;
27 33
 
28
-//    @Resource
29
-//    private BasicStorehouseService basicStorehouseService;
34
+    @Resource
35
+    private WarehouseSealingRecordMapper WarehouseSealingRecordMapper;
30 36
 
31 37
 
32 38
 
@@ -66,17 +72,80 @@ public class ClearanceConfirmationServiceImpl implements ClearanceConfirmationSe
66 72
             dwbm = org.get("creditCode") == null?"":org.get("creditCode").toString();
67 73
         }
68 74
 
75
+        LocalDate currentDate = LocalDate.now();
76
+        DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("yyyyMMdd");
77
+        String formattedDate = currentDate.format(formatter1);
69 78
         Date date = new Date();
70 79
         // JSON字符串转对象
71 80
         ObjectMapper mapper = new ObjectMapper();
72 81
         ClearanceConfirmation ClearanceConfirmation = (ClearanceConfirmation) mapper.readValue(clearanceConfirmationJson, ClearanceConfirmation.class);
73 82
         if (ClearanceConfirmation.getId() == null) {
83
+            //根据货位查询同一货位编码
84
+            WareHouseVO wareHouseVO= WarehouseSealingRecordMapper.selectTyhwbm(Integer.parseInt(ClearanceConfirmation.getWarehouseId()));
85
+
74 86
             modelMap1.put("cqqrdh",ClearanceConfirmation.getCqqrdh());
75 87
             List<ClearanceConfirmation> clearanceConfirmation = ClearanceConfirmationMapper.findByCleConList(modelMap1);
76 88
             if(clearanceConfirmation.size()>0){
77 89
                 modelMap.put("message", "出清确认单号已经存在");
78 90
                 return modelMap;
79 91
             }
92
+            ClearanceConfirmation clearanceConfirmation1=  ClearanceConfirmationMapper.selectByCqqrd(ClearanceConfirmation.getWarehouseId());
93
+            if(clearanceConfirmation1!=null){
94
+
95
+                String fcqrd =clearanceConfirmation1.getCqqrdh();
96
+
97
+                int startIndex =fcqrd.length() - 11; // 假设20240909开始的位置是从字符串末尾数第15个字符开始
98
+                // 要截取的结束位置
99
+                int endIndex = fcqrd.length() - 3; // 假设20240909结束的位置是从字符串末尾数第9个字符结束
100
+
101
+                // 使用substring方法进行截取
102
+                String extractedDate = fcqrd.substring(startIndex, endIndex);
103
+                // 当前时间
104
+
105
+                // 将字符串转换为日期对象
106
+                String specificDateStr = extractedDate;
107
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
108
+                LocalDate specificDateObj = LocalDate.parse(specificDateStr, formatter);
109
+                LocalDate today = LocalDate.now();
110
+
111
+                if (formattedDate.equals(extractedDate)){
112
+                    // 使用正则表达式提取后三位数字
113
+                    Pattern pattern = Pattern.compile("(\\d{3})$");
114
+                    Matcher matcher = pattern.matcher(fcqrd);
115
+                    if (matcher.find()) {
116
+                        String lastThreeDigits = matcher.group(1);
117
+
118
+                        // 将后三位数字转换为整数并加1
119
+                        int incrementedValue = Integer.parseInt(lastThreeDigits) + 1;
120
+
121
+                        // 将加1后的整数转换回三位数字字符串,保持前导零
122
+                        String incrementedDigits = String.format("%03d", incrementedValue);
123
+
124
+                        // 将原字符串的后三位替换为加1后的三位数字
125
+                        fcqrd = fcqrd.replaceFirst(pattern.pattern(), incrementedDigits);
126
+                        ClearanceConfirmation.setCqqrdh(fcqrd);
127
+                    }
128
+                }else{
129
+                    StringBuffer sbf = new StringBuffer();
130
+                    sbf.append(wareHouseVO.getTyhwbm());
131
+                    sbf.append(specificDateObj);
132
+                    sbf.append("001");
133
+                    ClearanceConfirmation.setCqqrdh(sbf.toString().trim());
134
+                }
135
+
136
+            }else{
137
+                StringBuffer sbf = new StringBuffer();
138
+                sbf.append(wareHouseVO.getTyhwbm());
139
+                sbf.append(formattedDate);
140
+                sbf.append("001");
141
+                ClearanceConfirmation.setCqqrdh(sbf.toString().trim());
142
+            }
143
+
144
+
145
+
146
+
147
+
148
+
80 149
             ClearanceConfirmation.setCreatename(userName);
81 150
             ClearanceConfirmation.setCreatedate(date);
82 151
             ClearanceConfirmation.setUpdatename(userName);
@@ -100,4 +169,15 @@ public class ClearanceConfirmationServiceImpl implements ClearanceConfirmationSe
100 169
     public void updateBasicStorehouse(ClearanceConfirmation ClearanceConfirmation){
101 170
         ClearanceConfirmationMapper.updateByPrimaryKey(ClearanceConfirmation);
102 171
     }
172
+
173
+    @Override
174
+    public List<StorageStorehouseBusiness> findStorehouse(Integer orgId) {
175
+        System.out.print(ClearanceConfirmationMapper.findStorehouseList(orgId));
176
+        return ClearanceConfirmationMapper.findStorehouseList(orgId);
177
+    }
178
+
179
+    @Override
180
+    public List<StorageStorehouseBusiness> findByWarehouse(Integer storehouseId) {
181
+        return ClearanceConfirmationMapper.findByWarehouseList(storehouseId);
182
+    }
103 183
 }

+ 3 - 0
src/main/resources/bootstrap-dev.yml

@@ -39,6 +39,9 @@ spring:
39 39
 #  jackson:
40 40
 #    date-format: yyyy-MM-dd
41 41
 #    time-zone: GMT+8
42
+logging:
43
+  level:
44
+    org.hibernate.SQL: DEBUG
42 45
 web:
43 46
   upload-path: /home/depot/depot-web/apache-tomcat-8.0.53/webapps/ROOT/WEB-INF/classes/static
44 47
 cxf: