Browse Source

粮情卡

ZeroLiYi 1 year ago
parent
commit
58ff49fe33

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

@@ -3,12 +3,16 @@ package com.chinaitop.depot.storage.mapper;
3 3
 import com.chinaitop.depot.storage.model.ClearanceConfirmation;
4 4
 import org.springframework.stereotype.Repository;
5 5
 
6
+import java.math.BigDecimal;
7
+import java.util.Date;
6 8
 import java.util.List;
7 9
 import java.util.Map;
8 10
 
9 11
 @Repository
10 12
 public interface ClearanceConfirmationMapper {
11 13
 
14
+    ClearanceConfirmation selectCqqrd(Integer warehouseId);
15
+
12 16
     List<ClearanceConfirmation> getCleConList(Map<String, Object> map);
13 17
 
14 18
     ClearanceConfirmation   findByCleCon(Integer id);
@@ -20,4 +24,7 @@ public interface ClearanceConfirmationMapper {
20 24
     List<ClearanceConfirmation> findByCleConList(Map<String, Object> modelMap1);
21 25
 
22 26
 
27
+    Map selectFcbgz(Map map);
28
+
29
+    Map<String, BigDecimal> getexcessLossQuantity(Integer warehouseId);
23 30
 }

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

@@ -136,6 +136,25 @@ cc.updatename updatename,cc.updatedate updatedate
136 136
     where cc.cqqrdh=#{cqqrdh,jdbcType=VARCHAR}
137 137
       AND (cc.czbz = 'i' OR cc.czbz = 'u')
138 138
   </select>
139
+  <select id="selectFcbgz" resultType="map">
140
+    select SUM(zcsl) as cksl from data_kcgl_fcbgz_default
141
+        where rq BETWEEN #{cqsj} AND #{fcsj}
142
+    and hwh=#{warehouseId}
143
+  </select>
144
+  <select id="getexcessLossQuantity" resultType="map">
145
+    select actual_loss_quantity as getexcessLossQuantity from business_gslr_loss_collect
146
+    where  warehouse_id=#{warehouseId}
147
+    order by id desc
148
+      limit 1
149
+  </select>
150
+
151
+  <select id="selectCqqrd" resultType="com.chinaitop.depot.storage.model.ClearanceConfirmation">
152
+    select updatedate from
153
+      clearance_confirmation where
154
+      warehouse_id=#{warehouseId}
155
+    order by id desc
156
+      limit 1
157
+  </select>
139 158
 
140 159
 
141 160
   <insert id="insert" keyProperty="id" useGeneratedKeys="true"  parameterType="com.chinaitop.depot.storage.model.ClearanceConfirmation">

+ 10 - 2
src/main/java/com/chinaitop/depot/storage/mapper/GrainSituationCardMapper.xml

@@ -160,7 +160,7 @@
160 160
   </delete>
161 161
   <insert id="insert" parameterType="com.chinaitop.depot.storage.model.GrainSituationCard" >
162 162
     insert into grain_situation_card (id, createname, createdate, 
163
-      updatename, updatedate, warehouse_sealing_record_id, 
163
+      updatename, updatedate, warehouse_sealing_record_id,excess_loss_quantity
164 164
       fill_org_id, keep_org_id, basic_storehouse_id, 
165 165
       basic_unit_aisle_id, warehouse_id, storehouse_type, 
166 166
       design_capacity, grain_variety_id, grain_nature_id, 
@@ -175,7 +175,8 @@
175 175
       packaged_count, average_weight, check_record_ids
176 176
       )
177 177
     values (#{id,jdbcType=INTEGER}, #{createname,jdbcType=VARCHAR}, #{createdate,jdbcType=TIMESTAMP}, 
178
-      #{updatename,jdbcType=VARCHAR}, #{updatedate,jdbcType=TIMESTAMP}, #{warehouseSealingRecordId,jdbcType=INTEGER}, 
178
+      #{updatename,jdbcType=VARCHAR}, #{updatedate,jdbcType=TIMESTAMP}, #{warehouseSealingRecordId,jdbcType=INTEGER},
179
+            #{excessLossQuantity,jdbcType=DECIMAL},
179 180
       #{fillOrgId,jdbcType=INTEGER}, #{keepOrgId,jdbcType=INTEGER}, #{basicStorehouseId,jdbcType=INTEGER}, 
180 181
       #{basicUnitAisleId,jdbcType=INTEGER}, #{warehouseId,jdbcType=INTEGER}, #{storehouseType,jdbcType=INTEGER}, 
181 182
       #{designCapacity,jdbcType=DECIMAL}, #{grainVarietyId,jdbcType=INTEGER}, #{grainNatureId,jdbcType=INTEGER}, 
@@ -445,6 +446,7 @@
445 446
   </select>
446 447
   <select id="selectCardList" resultType="com.chinaitop.depot.storage.model.GrainSituationCard" resultMap="BaseResultMap1">
447 448
     SELECT
449
+    gsr.id,
448 450
       o.org_name orgName,
449 451
       st.storehouse_name storehouseName,
450 452
       wa.warehouse_name warehouseName,
@@ -522,6 +524,9 @@
522 524
       <if test="record.updatedate != null" >
523 525
         updatedate = #{record.updatedate,jdbcType=TIMESTAMP},
524 526
       </if>
527
+      <if test="record.excessLossQuantity != null" >
528
+        excess_loss_quantity = #{record.excessLossQuantity,jdbcType=DECIMAL},
529
+      </if>
525 530
       <if test="record.warehouseSealingRecordId != null" >
526 531
         warehouse_sealing_record_id = #{record.warehouseSealingRecordId,jdbcType=INTEGER},
527 532
       </if>
@@ -673,6 +678,9 @@
673 678
       silo_grain_height = #{record.siloGrainHeight,jdbcType=DECIMAL},
674 679
       packaged_count = #{record.packagedCount,jdbcType=INTEGER},
675 680
       average_weight = #{record.averageWeight,jdbcType=DECIMAL},
681
+
682
+      excess_loss_quantity = #{record.excessLossQuantity,jdbcType=DECIMAL},
683
+
676 684
       check_record_ids = #{record.checkRecordIds,jdbcType=VARCHAR}
677 685
     <if test="_parameter != null" >
678 686
       <include refid="Update_By_Example_Where_Clause" />

+ 0 - 242
src/main/java/com/chinaitop/depot/storage/model/WarehouseSealingRecord.java

@@ -30,22 +30,6 @@ public class WarehouseSealingRecord {
30 30
     @ApiModelProperty(value = "粮食产地;basic_enum的id;粮食产地名称")
31 31
     private String producerName;
32 32
 
33
-    public String getGrainVarietyName() {
34
-        return grainVarietyName;
35
-    }
36
-
37
-    public void setGrainVarietyName(String grainVarietyName) {
38
-        this.grainVarietyName = grainVarietyName;
39
-    }
40
-
41
-    public String getGrainNatureName() {
42
-        return grainNatureName;
43
-    }
44
-
45
-    public void setGrainNatureName(String grainNatureName) {
46
-        this.grainNatureName = grainNatureName;
47
-    }
48
-
49 33
     private Integer id;
50 34
     private String czbz;
51 35
     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@@ -101,230 +85,4 @@ public class WarehouseSealingRecord {
101 85
     @ApiModelProperty(value = "库区ID")
102 86
     private Integer orgId;
103 87
 
104
-    public Integer getBasicStorehouseId() {
105
-        return basicStorehouseId;
106
-    }
107
-
108
-    public void setBasicStorehouseId(Integer basicStorehouseId) {
109
-        this.basicStorehouseId = basicStorehouseId;
110
-    }
111
-
112
-    public Integer getBasicUnitAisleId() {
113
-        return basicUnitAisleId;
114
-    }
115
-
116
-    public void setBasicUnitAisleId(Integer basicUnitAisleId) {
117
-        this.basicUnitAisleId = basicUnitAisleId;
118
-    }
119
-
120
-    public Integer getWarehouseId() {
121
-        return warehouseId;
122
-    }
123
-
124
-    public void setWarehouseId(Integer warehouseId) {
125
-        this.warehouseId = warehouseId;
126
-    }
127
-
128
-
129
-    public Integer getId() {
130
-        return id;
131
-    }
132
-
133
-    public void setId(Integer id) {
134
-        this.id = id;
135
-    }
136
-
137
-    public String getCzbz() {
138
-        return czbz;
139
-    }
140
-
141
-    public void setCzbz(String czbz) {
142
-        this.czbz = czbz;
143
-    }
144
-
145
-    public Date getZhgxsj() {
146
-        return zhgxsj;
147
-    }
148
-
149
-    public void setZhgxsj(Date zhgxsj) {
150
-        this.zhgxsj = zhgxsj;
151
-    }
152
-
153
-    public String getCreatename() {
154
-        return createname;
155
-    }
156
-
157
-    public void setCreatename(String createname) {
158
-        this.createname = createname;
159
-    }
160
-
161
-    public Date getCreatedate() {
162
-        return createdate;
163
-    }
164
-
165
-    public Integer getGrainVarietyId() {
166
-        return grainVarietyId;
167
-    }
168
-
169
-    public void setGrainVarietyId(Integer grainVarietyId) {
170
-        this.grainVarietyId = grainVarietyId;
171
-    }
172
-
173
-    public Integer getGrainNatureId() {
174
-        return grainNatureId;
175
-    }
176
-
177
-    public void setGrainNatureId(Integer grainNatureId) {
178
-        this.grainNatureId = grainNatureId;
179
-    }
180
-
181
-    public Integer getGrainGradeId() {
182
-        return grainGradeId;
183
-    }
184
-
185
-    public void setGrainGradeId(Integer grainGradeId) {
186
-        this.grainGradeId = grainGradeId;
187
-    }
188
-
189
-    public Integer getGrainAreaId() {
190
-        return grainAreaId;
191
-    }
192
-
193
-    public void setGrainAreaId(Integer grainAreaId) {
194
-        this.grainAreaId = grainAreaId;
195
-    }
196
-
197
-    public void setCreatedate(Date createdate) {
198
-        this.createdate = createdate;
199
-    }
200
-
201
-    public String getUpdatename() {
202
-        return updatename;
203
-    }
204
-
205
-    public void setUpdatename(String updatename) {
206
-        this.updatename = updatename;
207
-    }
208
-
209
-    public Date getUpdatedate() {
210
-        return updatedate;
211
-    }
212
-
213
-    public void setUpdatedate(Date updatedate) {
214
-        this.updatedate = updatedate;
215
-    }
216
-
217
-    public String getFcqrdh() {
218
-        return fcqrdh;
219
-    }
220
-
221
-    public void setFcqrdh(String fcqrdh) {
222
-        this.fcqrdh = fcqrdh;
223
-    }
224
-
225
-    public Date getYwrq() {
226
-        return ywrq;
227
-    }
228
-
229
-    public void setYwrq(Date ywrq) {
230
-        this.ywrq = ywrq;
231
-    }
232
-
233
-    public String getBgy() {
234
-        return bgy;
235
-    }
236
-
237
-    public void setBgy(String bgy) {
238
-        this.bgy = bgy;
239
-    }
240
-
241
-
242
-    public BigDecimal getLssl() {
243
-        return lssl;
244
-    }
245
-
246
-    public void setLssl(BigDecimal lssl) {
247
-        this.lssl = lssl;
248
-    }
249
-
250
-
251
-    public Year getShnd() {
252
-        return shnd;
253
-    }
254
-
255
-    public void setShnd(Year shnd) {
256
-        this.shnd = shnd;
257
-    }
258
-
259
-    public String getSqr() {
260
-        return sqr;
261
-    }
262
-
263
-    public void setSqr(String sqr) {
264
-        this.sqr = sqr;
265
-    }
266
-
267
-    public String getBmsh() {
268
-        return bmsh;
269
-    }
270
-
271
-    public void setBmsh(String bmsh) {
272
-        this.bmsh = bmsh;
273
-    }
274
-
275
-    public String getDwldsh() {
276
-        return dwldsh;
277
-    }
278
-
279
-    public void setDwldsh(String dwldsh) {
280
-        this.dwldsh = dwldsh;
281
-    }
282
-
283
-    public String getBz() {
284
-        return bz;
285
-    }
286
-
287
-    public void setBz(String bz) {
288
-        this.bz = bz;
289
-    }
290
-
291
-    public Date getRcsj() {
292
-        return rcsj;
293
-    }
294
-
295
-    public void setRcsj(Date rcsj) {
296
-        this.rcsj = rcsj;
297
-    }
298
-
299
-    public String getGlfs() {
300
-        return glfs;
301
-    }
302
-
303
-    public void setGlfs(String glfs) {
304
-        this.glfs = glfs;
305
-    }
306
-
307
-    public Integer getStatus() {
308
-        return status;
309
-    }
310
-
311
-    public void setStatus(Integer status) {
312
-        this.status = status;
313
-    }
314
-
315
-    public String getStorehouseName() {
316
-        return storehouseName;
317
-    }
318
-
319
-    public void setStorehouseName(String storehouseName) {
320
-        this.storehouseName = storehouseName;
321
-    }
322
-
323
-    public String getAjmc() {
324
-        return ajmc;
325
-    }
326
-
327
-    public void setAjmc(String ajmc) {
328
-        this.ajmc = ajmc;
329
-    }
330 88
 }

+ 30 - 8
src/main/java/com/chinaitop/depot/storage/service/impl/WarehouseSealingRecordServiceImpl.java

@@ -1,8 +1,10 @@
1 1
 package com.chinaitop.depot.storage.service.impl;
2 2
 
3 3
 import com.alibaba.fastjson.JSONObject;
4
+import com.chinaitop.depot.storage.mapper.ClearanceConfirmationMapper;
4 5
 import com.chinaitop.depot.storage.mapper.GrainSituationCardMapper;
5 6
 import com.chinaitop.depot.storage.mapper.WarehouseSealingRecordMapper;
7
+import com.chinaitop.depot.storage.model.ClearanceConfirmation;
6 8
 import com.chinaitop.depot.storage.model.GrainSituationCard;
7 9
 import com.chinaitop.depot.storage.model.StorageStorehouseBusiness;
8 10
 import com.chinaitop.depot.storage.model.WarehouseSealingRecord;
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
15 17
 
16 18
 import javax.annotation.Resource;
17 19
 import javax.servlet.http.HttpServletRequest;
20
+import java.math.BigDecimal;
18 21
 import java.time.LocalDate;
19 22
 import java.time.LocalDateTime;
20 23
 import java.time.format.DateTimeFormatter;
@@ -34,8 +37,8 @@ public class WarehouseSealingRecordServiceImpl implements WarehouseSealingRecord
34 37
     @Resource
35 38
     private GrainSituationCardMapper grainSituationCardMapper;
36 39
 
37
-//    @Resource
38
-//    private BasicStorehouseService basicStorehouseService;
40
+    @Resource
41
+    private ClearanceConfirmationMapper clearanceConfirmationMapper;
39 42
 
40 43
 
41 44
 
@@ -81,11 +84,11 @@ public class WarehouseSealingRecordServiceImpl implements WarehouseSealingRecord
81 84
             if(wareHouseVO!=null){
82 85
                 WarehouseSealingRecord warehouseSealingRecord=  WarehouseSealingRecordMapper.selectFcqrd(WarehouseSealingRecord.getWarehouseId());
83 86
                 if(warehouseSealingRecord!=null){
84
-                    if(warehouseSealingRecord.getStatus()==1){
85
-                        modelMap.put("message", "该货位已经生成粮情卡");
86
-                        return modelMap;
87
-
88
-                    }
87
+//                    if(warehouseSealingRecord.getStatus()==1){
88
+//                        modelMap.put("message", "该货位已经生成粮情卡");
89
+//                        return modelMap;
90
+//
91
+//                    }
89 92
                     String fcqrd =warehouseSealingRecord.getFcqrdh();
90 93
                     int startIndex =fcqrd.length() - 11; // 假设20240909开始的位置是从字符串末尾数第15个字符开始
91 94
                     // 要截取的结束位置
@@ -150,7 +153,25 @@ public class WarehouseSealingRecordServiceImpl implements WarehouseSealingRecord
150 153
             WarehouseSealingRecord.setCzbz("u");
151 154
             WarehouseSealingRecordMapper.updateByPrimaryKey(WarehouseSealingRecord);
152 155
         }
156
+
153 157
         if(WarehouseSealingRecord.getStatus()==1){
158
+            //查询出清确认单时间
159
+            int sum =0;
160
+            Date cqsj;
161
+            BigDecimal cksl;
162
+            ClearanceConfirmation clearanceConfirmation = clearanceConfirmationMapper.selectCqqrd(WarehouseSealingRecord.getWarehouseId());
163
+            if(clearanceConfirmation.getUpdatedate()==null){
164
+                cqsj= new Date();
165
+            }
166
+             cqsj =clearanceConfirmation.getUpdatedate();
167
+            //查询fcbgz
168
+            Map map =new HashMap<>();
169
+            map.put("warehouseId",WarehouseSealingRecord.getWarehouseId());
170
+            map.put("cqsj",cqsj);
171
+            map.put("fcsj",date);
172
+            Map<String, Double> map1=clearanceConfirmationMapper.selectFcbgz(map);
173
+             cksl =BigDecimal.valueOf(map1.get("cksl"));
174
+            Map<String,BigDecimal> mmap=clearanceConfirmationMapper.getexcessLossQuantity(WarehouseSealingRecord.getWarehouseId());
154 175
             GrainSituationCard grainSituationCard =new GrainSituationCard();
155 176
             grainSituationCard.setCreatedate(date);
156 177
             grainSituationCard.setUpdatedate(date);
@@ -167,9 +188,10 @@ public class WarehouseSealingRecordServiceImpl implements WarehouseSealingRecord
167 188
             grainSituationCard.setLssl(WarehouseSealingRecord.getLssl());
168 189
             grainSituationCard.setShnd(WarehouseSealingRecord.getShnd());
169 190
             grainSituationCard.setRcsj(WarehouseSealingRecord.getRcsj());
170
-            grainSituationCard.setOutQuantity(WarehouseSealingRecord.getLssl());
191
+            grainSituationCard.setOutQuantity(cksl);
171 192
             grainSituationCard.setFormWarehouseTime(WarehouseSealingRecord.getZhgxsj());
172 193
             grainSituationCard.setStorageOrgId(WarehouseSealingRecord.getOrgId());
194
+            grainSituationCard.setExcessLossQuantity(mmap.get("getexcessLossQuantity"));
173 195
             grainSituationCardMapper.insert(grainSituationCard);
174 196
         }
175 197
         modelMap.put("status", "success");