Bläddra i källkod

封仓确认单bug修改

fanxw 1 år sedan
förälder
incheckning
40c0885b53

+ 1 - 1
src/main/java/com/chinaitop/depot/grainSituationCard/mapper/StorageSealedConfirmationMapper.java

@@ -37,7 +37,7 @@ public interface StorageSealedConfirmationMapper {
37 37
 
38 38
     StorageSealedConfirmation checkGrainAttribute(@Param("orgId") Integer orgId, @Param("houseId") Integer houseId, @Param("warehouseId") Integer warehouseId);
39 39
 
40
-    Integer checkNoticeReceive(@Param("orgId") Integer orgId, @Param("houseId") Integer houseId, @Param("warehouseId") Integer warehouseId);
40
+    Integer checkNoticeReceive(Map<String, Object> map);
41 41
 
42 42
     String checkAuditState(@Param("houseId") Integer houseId, @Param("harvestYear") Integer harvestYear, @Param("warehouseId") Integer warehouseId);
43 43
 }

+ 49 - 41
src/main/java/com/chinaitop/depot/grainSituationCard/mapper/StorageSealedConfirmationMapper.xml

@@ -384,55 +384,63 @@
384 384
     where id = #{id,jdbcType=VARCHAR}
385 385
   </update>
386 386
   <select id="selectNotSealedStorage" parameterType="integer" resultType="com.chinaitop.depot.param.BasicStorageAndTankParam">
387
-    select
388
-        bs.storehouse_id houseId,
389
-        bs.storehouse_code storehouseCode,
390
-        bs.storehouse_name houseName
391
-    from
392
-        basic_storehouse bs
393
-        left join storage_grain_card sgc on bs.storehouse_id = sgc.storehouse_id
394
-        and sgc.sfgd = '1'
395
-        and sgc.sfmc = 1
396
-    where
397
-        bs.del_flag = 1
398
-        and bs.org_id = #{orgId}
399
-        and sgc.id is null
387
+    select 
388
+      a.storehouse_id houseId,
389
+      b.storehouse_name houseName
390
+	from basic_warehouse a
391
+	left join basic_storehouse b on b.storehouse_id=a.storehouse_id
392
+	where a.del_flag=1 
393
+	and a.library_type=0
394
+	and a.crk_status in (2,4)
395
+	and a.org_id=#{orgId}
396
+	group by a.storehouse_id,b.storehouse_name
397
+	union all
398
+	select 
399
+	  a.id houseId,
400
+	  a.storagetank_name houseName
401
+	from basic_tank a
402
+	where a.del_flag=1 
403
+	and a.library_type=0
404
+	and a.crk_status in (2,4)
405
+	and a.org_id=#{orgId}
400 406
   </select>
401 407
   <select id="checkGrainAttribute" parameterType="integer" resultType="com.chinaitop.depot.grainSituationCard.model.StorageSealedConfirmation">
402 408
     select
403
-        house_id houseId,
404
-        org_id orgId,
405
-        warehouse_id warehouseId,
406
-        sub_type grainKind,
407
-        quality grainAttribute,
408
-        number_update sealedNumber,
409
-        ypdj grainGrade,
410
-        location placeOfOrigin,
411
-        harvest_time harvestYear
412
-    from
413
-        storage_qualitycheck
409
+        ch houseId,
410
+        unitid orgId,
411
+        hwh warehouseId,
412
+        pz grainKind,
413
+        hwxz grainAttribute,
414
+        kcsl sealedNumber,
415
+        dj grainGrade,
416
+        gb placeOfOrigin,
417
+        scnf harvestYear,
418
+        rq applyTime
419
+    from lsreport_ts:data_kcgl_kcsw_default
414 420
     <where>
415
-      history_status = 0
416
-      and type_update = '0'
417
-      and org_id = #{orgId}
418
-      and house_id = #{houseId}
419
-      <if test="warehouseId != null and warehouseId != ''">
420
-        and warehouse_id = #{warehouseId}
421
-      </if>
421
+      and ch = #{houseId}
422
+      and hwh = #{warehouseId}
423
+      and hwxz in(
424
+              6864,
425
+              6865,
426
+              6877,
427
+              6878,
428
+              6879,
429
+              6866
430
+            )
422 431
     </where>
423
-    order by id desc limit 0,1
424 432
   </select>
425
-  <select id="checkNoticeReceive" parameterType="integer" resultType="integer">
433
+  <select id="checkNoticeReceive" parameterType="java.util.Map" resultType="integer">
426 434
     select
427 435
         hzqlsxzdm
428
-    from
429
-        business_notice_receive
430
-    where
431
-        org_id = #{orgId}
432
-        and house_id = #{houseId}
433
-        and ware_house_id = #{warehouseId}
434
-    order by
435
-        id desc limit 0,1
436
+    from business_notice_receive
437
+    where is_sheet=0 and audit_state=6 and crktype=1
438
+        and house_id = #{houseId,jdbcType=INTEGER}
439
+        <if test="warehouseId != null">
440
+        and ware_house_id = #{warehouseId,jdbcType=INTEGER}
441
+        </if>
442
+        receive_time > #{applyTime,,jdbcType=TIMESTAMP}
443
+    order by id desc limit 0,1
436 444
   </select>
437 445
     <select id="checkAuditState" parameterType="object" resultType="string">
438 446
       select

+ 10 - 5
src/main/java/com/chinaitop/depot/grainSituationCard/service/impl/StorageSealedConfirmationImpl.java

@@ -131,19 +131,24 @@ public class StorageSealedConfirmationImpl implements StorageSealedConfirmationS
131 131
 
132 132
     @Override
133 133
     public StorageSealedConfirmation checkGrainAttribute(Integer orgId, Integer houseId, Integer warehouseId) {
134
+    	//查询这个货位对应的储备粮库存数据
134 135
         StorageSealedConfirmation confirmation = confirmationMapper.checkGrainAttribute(orgId, houseId, warehouseId);
135 136
         if (!ObjectUtils.isEmpty(confirmation)) {
136
-            // 效验查询性质转变后粮食性质
137
-            Integer grainAttribute = confirmationMapper.checkNoticeReceive(orgId, houseId, warehouseId);
137
+            // 效验查询入库性质转变单数据(查询最后一车时间往后的数据)
138
+        	Map<String, Object> map = new HashMap<>();
139
+        	map.put("houseId", houseId);
140
+        	if (!houseId.equals(warehouseId)) {
141
+        		map.put("warehouseId", warehouseId);
142
+        	}
143
+        	map.put("applyTime", confirmation.getApplyTime());
144
+            Integer grainAttribute = confirmationMapper.checkNoticeReceive(map);
138 145
             // 未做性质转变
139 146
             if (ObjectUtils.isEmpty(grainAttribute)) {
140
-                return null;
147
+                return confirmation;
141 148
             } else {
142 149
                 // 对比粮食性质是否为储备粮
143 150
                 if (6864 == grainAttribute || 6865 == grainAttribute || 6877 == grainAttribute || 6878 == grainAttribute || 6879 == grainAttribute || 6866 == grainAttribute) {
144 151
                     confirmation.setGrainAttribute(grainAttribute);
145
-                } else {
146
-                    return null;
147 152
                 }
148 153
             }
149 154
         }