瀏覽代碼

手动清场默认当前时间

liyg 2 年之前
父節點
當前提交
2b1fb1f5bc
共有 1 個文件被更改,包括 20 次插入7 次删除
  1. 20 7
      src/main/java/com/steerinfo/dil/service/impl/WmshGridMaterialServiceImpl.java

+ 20 - 7
src/main/java/com/steerinfo/dil/service/impl/WmshGridMaterialServiceImpl.java

@@ -37,6 +37,8 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
     private WmshOutboundResultMapper wmshOutboundResultMapper;
     @Autowired
     private WmshInboundResultMapper wmshInboundResultMapper;
+
+    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
     /**
      * 展示下游港口实时库存
      * @param mapVal
@@ -54,6 +56,9 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
      */
     @Override
     public List<Map<String, Object>> getLoadPortStockList(Map<String, Object> mapVal) {
+        if(mapVal.get("oneDate")!=null){
+            mapVal.put("time",new Date((Long)mapVal.get("oneDate")));
+        }
         return wmshGridMaterialMapper.getLoadPortStockList(mapVal);
     }
 
@@ -64,7 +69,11 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
 
     @Override
     public List<Map<String, Object>> getRunStockList(Map<String, Object> mapVal) {
-        mapVal.put("oneDate",getNowDate());
+        if(mapVal.get("oneDate")==null){
+            mapVal.put("oneDate",getNowDate());
+        }else{
+            mapVal.put("oneDate",sdf.format(new Date((Long)mapVal.get("oneDate"))));
+        }
         return wmshGridMaterialMapper.getRunStockList(mapVal);
     }
 
@@ -147,11 +156,13 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
         if (map.get("resultLoadShipDate") != null) {
             long resultLoadShipDate =(long) map.get("resultLoadShipDate");
             wmshOutboundResult.setWorkTime(new Date(resultLoadShipDate));
-        }
-        //按照出库时间作为万州港出库作业时间
-        if (map.get("resultLoadingDate") != null) {
+        }else if (map.get("resultLoadingDate") != null) {
+            //按照出库时间作为万州港出库作业时间
             long resultLoadingDate =(long) map.get("resultLoadingDate");
             wmshOutboundResult.setWorkTime(new Date(resultLoadingDate));
+        }else{
+            //手动清场使用当前时间
+            wmshOutboundResult.setWorkTime(new Date());
         }
         i = wmshOutboundResultMapper.insertSelective(wmshOutboundResult);
         return id.intValue();
@@ -218,14 +229,16 @@ public class WmshGridMaterialServiceImpl implements IWmshGridMaterialService {
 
     @Override
     public List<Map<String, Object>> selectAllShip(Map<String, Object> map) {
-        map.put("oneDate",getNowDate());
+        if(map.get("oneDate")==null){
+            map.put("oneDate",getNowDate());
+        }else{
+            map.put("oneDate",sdf.format(new Date((Long)map.get("oneDate"))));
+        }
         List<Map<String, Object>> list = wmshGridMaterialMapper.selectAllShip(map);
         return list;
     }
 
     private String getNowDate(){
-        //设置当前的时间节点
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Date oneDate=new Date();
         int hour=oneDate.getHours();
         if(hour >= 8 && hour < 18){