Parcourir la source

新增查询封仓后的出库质检接口

fanxw il y a 1 an
Parent
commit
4d104160a2

+ 20 - 1
src/main/java/com/chinaitop/depot/storage/controller/StorageQualitycheckController.java

@@ -638,7 +638,7 @@ public class StorageQualitycheckController {
638 638
         	if (pageNum!=null && pageSize!=null) {
639 639
         		PageHelper.startPage(pageNum, pageSize);
640 640
         	}
641
-			list = storageQualitycheckService.getList(houseId, wareId, checkType, checkResult, historyStatus, orgId, processState);
641
+			list = storageQualitycheckService.getList(houseId, wareId, checkType, checkResult, historyStatus, orgId, processState, null, null);
642 642
 			pageInfo = new PageInfo<StorageQualitycheck>(list);
643 643
 		} catch (Exception e) {
644 644
 			e.printStackTrace();
@@ -828,4 +828,23 @@ public class StorageQualitycheckController {
828 828
 
829 829
         return retMap;
830 830
     }
831
+    
832
+    @RequestMapping(value="/findConditionCkCheck", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
833
+    @ApiOperation(value="查询一个货位在封仓后的出库检验数据", notes = "")
834
+    @ApiImplicitParams({
835
+            @ApiImplicitParam(name = "houseId", value = "仓房ID", paramType = "query"),
836
+            @ApiImplicitParam(name = "wareId", value = "货位ID", paramType = "query"),
837
+            @ApiImplicitParam(name = "checkType", value = "检验类型", paramType = "query")
838
+    })
839
+    public Map<String, Object> findConditionCkCheck(Integer houseId, Integer wareId, String checkType){
840
+
841
+    	Map<String, Object> retMap = new HashMap<>();
842
+    	try {
843
+    		retMap = storageQualitycheckService.findConditionCkCheck(houseId, wareId, checkType);
844
+		} catch (Exception e) {
845
+			e.printStackTrace();
846
+		}
847
+
848
+        return retMap;
849
+    }
831 850
 }

+ 9 - 1
src/main/java/com/chinaitop/depot/storage/mapper/StorageQualitycheckMapper.java

@@ -63,9 +63,17 @@ public interface StorageQualitycheckMapper {
63 63
     Map<String, Object> getcheckById(Integer id);
64 64
 
65 65
     /**
66
-     * 查询出入库应急端的URL地址
66
+     * 查询出入库应急端的URL地址
67 67
      * @param orgId
68 68
      * @return
69 69
      */
70 70
 	String findConditionCrkYjdUrl(Integer orgId);
71
+
72
+	/**
73
+	 * 查询当前仓房的最后一条封仓数据的封仓时间
74
+	 * @param houseId 仓房ID
75
+	 * @param wareId 货位ID
76
+	 * @return
77
+	 */
78
+	String findConditionFcsj(Map<String, Object> paramMap);
71 79
 }

+ 15 - 1
src/main/java/com/chinaitop/depot/storage/mapper/StorageQualitycheckMapper.xml

@@ -2182,7 +2182,21 @@
2182 2182
     and bswd.type = "notice"
2183 2183
   </select>
2184 2184
 
2185
-  <select id="findId" resultType="java.lang.String" parameterType="java.lang.String">
2185
+  <select id="findConditionCrkYjdUrl" resultType="java.lang.String" parameterType="java.lang.String">
2186 2186
      select intranet_url from t_url_config where org_id=#{orgId,jdbcType=VARCHAR} and user_type='2'
2187 2187
   </select>
2188
+  
2189
+  <select id="findConditionFcsj" parameterType="java.util.Map" resultType="java.lang.String">
2190
+      select to_char(datas.accept_date, 'yyyy-MM-dd HH24:mi:ss') fcsj from (
2191
+          select accept_date, Row_Number() OVER (partition by storehouse_id, warehouse_id order by accept_date desc) rank from storage_grain_card 
2192
+          where sfmc='1'
2193
+          <if test="houseId != null">
2194
+          and storehouse_id=#{houseId,jdbcType=VARCHAR}
2195
+          </if>
2196
+          <if test="warehouseId != null">
2197
+          and warehouse_id=#{warehouseId,jdbcType=VARCHAR}
2198
+          </if>
2199
+      ) as datas 
2200
+      where 1=1 and datas.rank=1
2201
+  </select>
2188 2202
 </mapper>

+ 13 - 1
src/main/java/com/chinaitop/depot/storage/service/StorageQualitycheckService.java

@@ -153,11 +153,14 @@ public interface StorageQualitycheckService {
153 153
 	 * @param historyStatus 数据状态(0:新数据,1:已归档数据)
154 154
 	 * @param orgId 组织机构ID
155 155
 	 * @param processState 1扦样化验待处理 2化验已处理
156
+	 * @param isdx 0:大于,1小于
157
+	 * @param isdx 0:大于,1小于
158
+	 * @param checkTime 检验时间
156 159
 	 * @return
157 160
 	 * @throws Exception
158 161
 	 */
159 162
 	List<StorageQualitycheck> getList(Integer houseId, Integer wareId, String checkType, String checkResult,
160
-			Integer historyStatus, Integer orgId, Integer processState) throws Exception;
163
+			Integer historyStatus, Integer orgId, Integer processState, String isdx, String checkTime) throws Exception;
161 164
 
162 165
 	/**
163 166
 	 * 按条件查询质检数据详情
@@ -172,4 +175,13 @@ public interface StorageQualitycheckService {
172 175
 	 */
173 176
 	Map<String, Object> queryCheckDataDetail(Integer houseId, Integer wareId, String checkType, 
174 177
 			Integer historyStatus, Integer orgId, Integer processState) throws Exception;
178
+
179
+	/**
180
+	 * 查询一个货位在封仓后的出库检验数据
181
+	 * @param houseId
182
+	 * @param wareId
183
+	 * @return
184
+	 * @throws Exception
185
+	 */
186
+	Map<String, Object> findConditionCkCheck(Integer houseId, Integer wareId, String checkType) throws Exception;
175 187
 }

+ 48 - 4
src/main/java/com/chinaitop/depot/storage/service/impl/StorageQualitycheckServiceImpl.java

@@ -405,7 +405,7 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
405 405
 
406 406
 	@Override
407 407
 	public void pushQualitycheckLsdj_crk(StorageQualitycheck qualitycheck, String ws_path) throws Exception {
408
-		if ("0".equals(qualitycheck.getTypeUpdate())) {
408
+		if ("0".equals(qualitycheck.getTypeUpdate())) {//只有粮食自检才走这里
409 409
 			String crk_yjd_url = qualitycheckMapper.findConditionCrkYjdUrl(qualitycheck.getOrgId());
410 410
 			if (StringUtils.isNotBlank(crk_yjd_url)) {
411 411
 				//拼接完整URL
@@ -429,11 +429,11 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
429 429
 
430 430
 	@Override
431 431
 	public List<StorageQualitycheck> getList(Integer houseId, Integer wareId, String checkType, String checkResult,
432
-			Integer historyStatus, Integer orgId, Integer processState) throws Exception {
432
+			Integer historyStatus, Integer orgId, Integer processState, String isdx, String checkTime) throws Exception {
433 433
 		StorageQualitycheckExample example = new StorageQualitycheckExample();
434 434
     	Criteria criteria = example.createCriteria();
435 435
 
436
-    	//0:初检 1:验收 2:质量普查 3:出库,5:第三方检验
436
+    	//0:初检 1:验收 2:质量普查 3:出库, 4:春秋普查,5:第三方检验
437 437
         if (StringUtils.isNotBlank(checkType)){
438 438
         	criteria.andTypeUpdateEqualTo(checkType);
439 439
         }
@@ -463,9 +463,22 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
463 463
         if (null != historyStatus) {
464 464
         	criteria.andHistoryStatusEqualTo(historyStatus);
465 465
         }
466
+        
467
+        //按照isdx查询检验时间范围
468
+        if (StringUtils.isNotBlank(isdx)) {
469
+        	if ("0".equals(isdx) && StringUtils.isNotBlank(checkTime)) {
470
+        		criteria.andCheckTimeGreaterThan(ParameterUtil.string2datetime(checkTime));
471
+        	}
472
+        	if ("1".equals(isdx) && StringUtils.isNotBlank(checkTime)) {
473
+        		criteria.andCheckTimeLessThan(ParameterUtil.string2datetime(checkTime));
474
+        	}
475
+        }
476
+
466 477
         //查询从质量管理功能里面添加到数据库的数据
467 478
         criteria.andFlagTypeIsNull();
468 479
 
480
+        example.setOrderByClause(" check_time desc");
481
+
469 482
         List<StorageQualitycheck> list = qualitycheckMapper.selectByExample(example);
470 483
 
471 484
 		return list;
@@ -474,7 +487,7 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
474 487
 	@Override
475 488
 	public Map<String, Object> queryCheckDataDetail(Integer houseId, Integer wareId, String checkType,
476 489
 			Integer historyStatus, Integer orgId, Integer processState) throws Exception {
477
-		List<StorageQualitycheck> list = getList(houseId, wareId, checkType, null, historyStatus, orgId, processState);
490
+		List<StorageQualitycheck> list = getList(houseId, wareId, checkType, null, historyStatus, orgId, processState, null , null);
478 491
 		Map<String, Object> retMap = null;
479 492
 		if (null != list && list.size() > 0) {
480 493
 			Integer id = list.get(0).getId();
@@ -482,4 +495,35 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
482 495
 		}
483 496
 		return retMap;
484 497
 	}
498
+
499
+	@Override
500
+	public Map<String, Object> findConditionCkCheck(Integer houseId, Integer wareId, String checkType) throws Exception {
501
+
502
+		//查询最近的封仓时间
503
+		Map<String, Object> paramMap = new HashMap<>();
504
+		if (null != houseId) {
505
+			paramMap.put("houseId", houseId);
506
+		}
507
+		if (null != wareId) {
508
+			paramMap.put("warehouseId", wareId);
509
+		}
510
+		String fcsj = qualitycheckMapper.findConditionFcsj(paramMap);
511
+
512
+		Map<String, Object> resultMap = new HashMap<>();
513
+		if (StringUtils.isNotBlank(fcsj)) {
514
+			List<StorageQualitycheck> list = getList(houseId, wareId, checkType, null, null, null, 2, "0" , fcsj);
515
+			if (null != list && list.size() > 0) {
516
+				resultMap.put("status", "200");
517
+				resultMap.put("msg", list);
518
+			} else {
519
+				resultMap.put("status", "500");
520
+				resultMap.put("msg", "未查到封仓之后的出库质检数据");
521
+			}
522
+		} else {
523
+			resultMap.put("status", "500");
524
+			resultMap.put("msg", "连封仓数据都没查到");
525
+		}
526
+
527
+		return resultMap;
528
+	}
485 529
 }