fanxw 5 lat temu
rodzic
commit
5de7cda29f

+ 7 - 0
src/main/java/com/chinaitop/depot/basic/mapper/BasicWarehouseMapper.java

@@ -31,4 +31,11 @@ public interface BasicWarehouseMapper {
31 31
     int updateByPrimaryKey(BasicWarehouse record);
32 32
 
33 33
 	void updateWareStatus(Map<String, Object> param);
34
+
35
+	/**
36
+	 * 查询一个仓房的封仓时间
37
+	 * @param param
38
+	 * @return
39
+	 */
40
+	List<Map<String, String>> queryFcdate(Map<String, Object> param);
34 41
 }

+ 6 - 1
src/main/java/com/chinaitop/depot/basic/mapper/BasicWarehouseMapper.xml

@@ -530,5 +530,10 @@
530 530
   <select id="updateWareStatus" parameterType="java.util.Map">
531 531
     update basic_warehouse set crk_status=#{status} where 1=1 and warehouse_id=#{wareId} and org_id=#{orgId}
532 532
   </select>
533
-
533
+
534
+  <!-- 查询封仓时间 -->
535
+  <select id="queryFcdate" parameterType="java.util.Map" resultType="java.util.Map">
536
+    SELECT filling_time from storage_foodbasicinfo WHERE warehouse_id=${wareId} 
537
+    AND history_status=0 AND seal_status='1' ORDER BY filling_time DESC
538
+  </select>
534 539
 </mapper>

+ 11 - 11
src/main/java/com/chinaitop/depot/job/service/impl/ScheduleJobServiceImpl.java

@@ -38,17 +38,17 @@ public class ScheduleJobServiceImpl implements ScheduleJobService {
38 38
 	 */
39 39
 	@PostConstruct
40 40
 	public void init() {
41
-	    ScheduleJobExample scheduleJobExample = new ScheduleJobExample();
42
-		List<ScheduleJob> scheduleJobList = scheduleJobMapper.selectByExample(scheduleJobExample);
43
-		for(ScheduleJob scheduleJob : scheduleJobList){
44
-			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getId());
45
-            //如果不存在,则创建
46
-            if(cronTrigger == null) {
47
-                ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
48
-            }else {
49
-                ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
50
-            }
51
-		}
41
+//	    ScheduleJobExample scheduleJobExample = new ScheduleJobExample();
42
+//		List<ScheduleJob> scheduleJobList = scheduleJobMapper.selectByExample(scheduleJobExample);
43
+//		for(ScheduleJob scheduleJob : scheduleJobList){
44
+//			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getId());
45
+//            //如果不存在,则创建
46
+//            if(cronTrigger == null) {
47
+//                ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
48
+//            }else {
49
+//                ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
50
+//            }
51
+//		}
52 52
 	}
53 53
 	
54 54
 	@Override

+ 34 - 3
src/main/java/com/chinaitop/depot/unissoft/webservice/BasicWarehouseWebServiceImpl.java

@@ -2,6 +2,7 @@ package com.chinaitop.depot.unissoft.webservice;
2 2
 
3 3
 import java.util.HashMap;
4 4
 import java.util.Iterator;
5
+import java.util.List;
5 6
 import java.util.Map;
6 7
 
7 8
 import javax.annotation.Resource;
@@ -12,6 +13,8 @@ import org.springframework.stereotype.Service;
12 13
 import com.alibaba.fastjson.JSONArray;
13 14
 import com.alibaba.fastjson.JSONObject;
14 15
 import com.chinaitop.depot.basic.mapper.BasicWarehouseMapper;
16
+import com.chinaitop.depot.basic.model.BasicWarehouse;
17
+import com.chinaitop.utils.ParameterUtil;
15 18
 
16 19
 @Service
17 20
 public class BasicWarehouseWebServiceImpl implements BasicWarehouseWebService {
@@ -39,19 +42,46 @@ public class BasicWarehouseWebServiceImpl implements BasicWarehouseWebService {
39 42
 						continue;
40 43
 					}
41 44
 
42
-					//货位ID
45
+					//货位ID(云南没有油罐的业务,不用判断是否是油罐)
43 46
 					String wareId = ObjectUtils.toString(json_object.get("hwId"), "");
44 47
 					//单位ID
45 48
 					String orgId = ObjectUtils.toString(json_object.get("org_Id"), "");
46 49
 					//货位状态值1空仓,2入库中,3封仓,4出库中,9其它
47 50
 					String status = ObjectUtils.toString(json_object.get("status"), "");
51
+					//业务时间
52
+					String ywsj = ObjectUtils.toString(json_object.get("cjsj"), "");
48 53
 
49 54
 					//修改数据
50 55
 					Map<String, Object> param = new HashMap<String, Object>();
51 56
 					param.put("wareId", Integer.parseInt(wareId));
52 57
 					param.put("orgId", Integer.parseInt(orgId));
53 58
 					param.put("status", status);
54
-					warehouseMapper.updateWareStatus(param);
59
+					param.put("ywsj", ywsj);
60
+					
61
+					/**
62
+					 * 1、查询当前仓房货位有没有封仓;
63
+					 * 2、如果封仓了,并且封仓时间在业务时间之前:那么就不回写当前传过来的状态,这个数据是在封仓前产生的
64
+					 * 3、如果封仓了,并且封仓时间在业务时间之后:那么就回写当前传过来的状态,这个数据是在封仓后产生的
65
+					 */
66
+					//查询当前货位状态
67
+					BasicWarehouse warehouse = warehouseMapper.selectByPrimaryKey(Integer.parseInt(wareId));
68
+					if (null != warehouse && "3".equals(warehouse.getCrkStatus())) {
69
+						//查询封仓时间
70
+						List<Map<String, String>> map = warehouseMapper.queryFcdate(param);
71
+						if (null != map && map.size() > 0) {
72
+							String fcsj = map.get(0).get("filling_time")+" 00:00:00";
73
+							//判断封仓时间在不在业务时间之前
74
+							if (ParameterUtil.string2datetime(fcsj).after(ParameterUtil.string2datetime(ywsj))) {
75
+								continue;
76
+							} else {
77
+								//回写状态
78
+								warehouseMapper.updateWareStatus(param);
79
+							}
80
+						}
81
+					} else {
82
+						//回写状态
83
+						warehouseMapper.updateWareStatus(param);
84
+					}
55 85
 				}
56 86
 			}
57 87
 			result.put("success", "true");
@@ -60,7 +90,8 @@ public class BasicWarehouseWebServiceImpl implements BasicWarehouseWebService {
60 90
 			e.printStackTrace();
61 91
 			result.put("success", "false");
62 92
 			result.put("msg", "上传失败");
63
-		} finally {
93
+		}
94
+		finally {
64 95
 			JSONArray jsonArray = new JSONArray();
65 96
 			jsonArray.add(result);
66 97
 			return jsonArray.toString();