Parcourir la source

Merge branch 'master' of https://gitee.com/antai-wuliu/ANTAI-API

# Conflicts:
#	src/main/java/com/steerinfo/dil/controller/AMScontroller.java
#	src/main/java/com/steerinfo/dil/feign/AmsFeign.java
zhangym il y a 1 an
Parent
commit
1189d2ec01

+ 1 - 1
src/main/java/com/steerinfo/dil/aspect/LogAspect.java

@@ -58,7 +58,7 @@ public class LogAspect {
         //获取该切点处的方法及入参
         Method method = ((MethodSignature) point.getSignature()).getMethod();
         Object[] requestParams = point.getArgs();
-        JSONObject map = null ;
+        JSONObject map = null;
         for(Object param:requestParams){
             if(param!=null && param instanceof Map){
                 map = JSONObject.parseObject(JSONObject.toJSONString(param));

+ 11 - 1
src/main/java/com/steerinfo/dil/config/RequestFilter.java

@@ -4,9 +4,13 @@ package com.steerinfo.dil.config;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.steerinfo.dil.aspect.LogAspect;
+import com.steerinfo.dil.mapper.BackgroundProcessingMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
 import javax.servlet.*;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -14,6 +18,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URLDecoder;
+import java.util.Map;
 
 @Component
 public class RequestFilter implements Filter {
@@ -22,6 +27,10 @@ public class RequestFilter implements Filter {
     @Override
     public void destroy() {}
 
+
+    @Resource
+    private BackgroundProcessingMapper backgroundProcessingMapper;
+
     @Override
     public void doFilter(ServletRequest request, ServletResponse response,FilterChain chain) throws IOException, ServletException {
        try{
@@ -77,7 +86,8 @@ public class RequestFilter implements Filter {
            httpRequest.setAttribute("orgCode", orgCode);
            Object roleCodesObject = JSONObject.parse(roleCodes);
            httpRequest.setAttribute("roleCodes", roleCodesObject);
-           Object dilCompanyListObject = JSONObject.parse(dilCompanyList);
+           //Object dilCompanyListObject = JSONObject.parse(dilCompanyList);
+           Object dilCompanyListObject =  backgroundProcessingMapper.getCompanyList(userId);
            httpRequest.setAttribute("dilCompanyList",dilCompanyListObject);
            Object rootCompanyMapObject = JSONObject.parse(rootCompanyMap);
            httpRequest.setAttribute("rootCompanyMap",rootCompanyMapObject);

+ 6 - 2
src/main/java/com/steerinfo/dil/controller/AMScontroller.java

@@ -867,8 +867,12 @@ public class AMScontroller  extends BaseRESTfulController {
     RESTfulResult updateBalancePl(@RequestBody Map<String,Object> map) {
         return amsFeign.updateBalancePl(map);
     }
-
-    @ApiOperation("固定需求新增")
+    @ApiOperation("重导WMS")
+    @PostMapping("/addWMS")
+    RESTfulResult addWMS(@RequestBody Map<String,Object> map) {
+        return amsFeign.addWMS(map);
+    }
+ @ApiOperation("固定需求新增")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
     })

+ 42 - 4
src/main/java/com/steerinfo/dil/controller/BackgroundProcessingController.java

@@ -51,12 +51,19 @@ public class BackgroundProcessingController extends BaseRESTfulController {
         if("succeed".equals(resMap.get("status"))) {
             Map<String, Object> dataMap = (Map<String, Object>) resMap.get("data");
             Map<String, Object> userInfo = (Map<String, Object>) dataMap.get("user");
-            // 根据用户名去查询该用户绑定的公司及下属公司
-            List<Map<String, Object>> companyList = backgroundProcessingMapper.getCompanyList(loginName);
-            if(companyList.size() > 0) {
+            // 根据用户名去查询该用户绑定的公司及下属公司;7.2改为只查本单位因前端会报错
+            List<Map<String, Object>> companyList = backgroundProcessingMapper.getCurrentCompanyList(loginName);
+            //List<Map<String, Object>> companyList = backgroundProcessingMapper.getCompanyList(loginName);
+            if(companyList != null && companyList.size() > 0) {
                 Map<String, Object> stringMap = new HashMap<>();
                 stringMap.put("companyId",-1);
                 companyList.add(stringMap);
+            }else{
+                //resMap.put("status","failed");
+                //resMap.put("message","账号未与单位关联,联系管理人员");
+                //resMap.put("resultMessage","账号未与单位关联,联系管理人员");
+                //resMap.put("code","500");
+                //return resMap;
             }
             Map<String,Object> rootCompanyMap = backgroundProcessingMapper.getCompanyRootMap(loginName);
             userInfo.put("dilCompanyList", companyList);
@@ -80,6 +87,7 @@ public class BackgroundProcessingController extends BaseRESTfulController {
             if(personnelMap != null){
                 dataMap.putAll(personnelMap);
             }
+            //注册cid
             System.out.println(dataMap);
         }
         return resMap;
@@ -93,11 +101,15 @@ public class BackgroundProcessingController extends BaseRESTfulController {
             searchMap.put("cid",dilAppCid.getCid());
             searchMap.put("userCode",dilAppCid.getUserCode());
             List<DilAppCid> mapList = dilAppCidMapper.selectByParameters(searchMap);
-            if(mapList.size() > 0 && mapList.get(0) != null) {
+            if(mapList != null && mapList.size() > 0 && mapList.get(0) != null) {
+                mapList.get(0).setUpdateTime(new Date());
+                dilAppCidMapper.updateByPrimaryKeySelective(mapList.get(0));
                 return success();
             }
             dilAppCid.setPrimaryId(dilAppCidMapper.nextId());
             dilAppCid.setInsertTime(new Date());
+            dilAppCid.setUpdateTime(new Date());
+            dilAppCid.setDeleted(0);
             dilAppCidMapper.insertSelective(dilAppCid);
         } catch (Exception e) {
             e.printStackTrace();
@@ -106,5 +118,31 @@ public class BackgroundProcessingController extends BaseRESTfulController {
     }
 
 
+    @ApiOperation("重置密码")
+    @PostMapping("/resetPwd")
+    public RESTfulResult  resetPwd(@RequestBody Map<String,Object> map) {
+        try {
+            if(map.get("ssoId") == null || map.get("ssoId").equals("")){
+                throw new Exception("用户账号不存在,请先联系管理员注册!");
+            }
+            return success(ssoUtil.resetPwd(map.get("ssoId").toString(),map.get("ssoCode").toString()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return  failed(map,e.getMessage());
+        }
+    }
 
+    @ApiOperation("解锁用户")
+    @PostMapping("/unlockUser")
+    public RESTfulResult  unlockUser(@RequestBody Map<String,Object> map) {
+        try {
+            if(map.get("ssoId") == null || map.get("ssoId").equals("")){
+                throw new Exception("用户账号不存在,请先联系管理员注册!");
+            }
+            return success(ssoUtil.unlockUser(map.get("ssoId").toString(),map.get("ssoCode").toString()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return  failed(map,e.getMessage());
+        }
+    }
 }

+ 10 - 0
src/main/java/com/steerinfo/dil/controller/RMScontroller.java

@@ -129,6 +129,11 @@ public class RMScontroller extends BaseRESTfulController {
     @PostMapping("/insertMaterialType")
     @LogAround(foreignKeys = {"materialTypeId"}, foreignKeyTypes = "物资类型", description = "新增物资类型")
     public RESTfulResult insertMaterialType(@RequestBody(required = false) Map<String, Object> map) {
+        List dilCompanyList = (List) map.get("dilCompanyList");
+        if(dilCompanyList != null && dilCompanyList.size() > 0) {
+            Map<String, Object> stringObjectMap = (Map<String, Object>) dilCompanyList.get(0);
+            map.put("companyId",stringObjectMap.get("companyId"));
+        }
         return rmsFeign.insertMaterialType(map);
     }
 
@@ -1286,6 +1291,11 @@ public class RMScontroller extends BaseRESTfulController {
     @PostMapping(value = "/insertTransRange")
     @LogAround(foreignKeys = {"transRangeId"}, foreignKeyTypes = "运输范围")
     public Map<String, Object> insertTransRange(@RequestBody(required = false) Map<String, Object> map) {
+        List dilCompanyList = (List) map.get("dilCompanyList");
+        if(dilCompanyList != null && dilCompanyList.size() > 0) {
+            Map<String, Object> stringObjectMap = (Map<String, Object>) dilCompanyList.get(0);
+            map.put("companyId",stringObjectMap.get("companyId"));
+        }
         return rmsFeign.insertTransRange(map);
     }
 

+ 15 - 0
src/main/java/com/steerinfo/dil/controller/ReportController.java

@@ -104,4 +104,19 @@ public class ReportController {
                                               Integer pageSize){
         return reportFeign.getTransReportCarrier(mapValue,apiId,pageNum,pageSize);
     }
+
+    @ApiOperation(value="型钢报表")
+    @PostMapping(value = "/getTransReportXG")
+    Map<String, Object> getTransReportXG(@RequestBody(required=false) HashMap<String,Object> mapValue,
+                                              Integer apiId,
+                                              Integer pageNum,
+                                              Integer pageSize){
+        return reportFeign.getTransReportXG(mapValue,apiId,pageNum,pageSize);
+    }
+
+    @ApiOperation(value="修改运价")
+    @PostMapping(value = "/updateTransUnitPrice")
+    Map<String, Object> updateTransUnitPrice(@RequestBody(required=false) HashMap<String,Object> map){
+        return reportFeign.updateTransUnitPrice(map);
+    }
 }

+ 11 - 4
src/main/java/com/steerinfo/dil/controller/SystemFileController.java

@@ -25,10 +25,7 @@ import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import java.awt.*;
 import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.math.BigDecimal;
@@ -425,4 +422,14 @@ public class SystemFileController extends BaseRESTfulController {
     //
     //    return watermarkedStream;
     //}
+    //读取文件
+    @PostMapping("/readExcel")
+    public RESTfulResult readExcel(@RequestParam String path) {
+        File file = new File(path);
+
+        return success();
+    }
+
+
+
 }

+ 166 - 99
src/main/java/com/steerinfo/dil/controller/TMSController.java

@@ -431,6 +431,8 @@ public class TMSController extends BaseRESTfulController {
         map.put("list", list);
         //统计通知单的重量车数和车牌号
         Set<String> capacitySet = new HashSet<>();//车牌号
+        List<String> requirementList = new ArrayList<>();
+        String loadDate = null;
         for (Map<String, Object> item : list) {
             //校验行
             if(item.get("通知单号")==null || item.get("通知单号").equals("")
@@ -443,31 +445,46 @@ public class TMSController extends BaseRESTfulController {
             }
             //通知单统计
             String requirementNumber = item.get("通知单号").toString();
-            if (map.get("requirementNumber") != null) {
-                if (map.get("requirementNumber").equals(requirementNumber)) {
-                    //已存在,修改
-                    BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
-                    BigDecimal truckNumber = DataChange.dataToBigDecimal(map.get("truckNumber"));
-                    String loadTime = map.get("loadTime").toString();
-                    weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
-                    truckNumber = truckNumber.add(new BigDecimal(1));
-                    map.put("weight", weight);
-                    map.put("truckNumber", truckNumber);
-                    if(!loadTime.equals(item.get("装车日期").toString())){
-                        throw new Exception("同一个Excel只允许一批车辆,请检查装车日期!");
-                    }
-                } else {
-                    throw new Exception("同一个Excel文件中只允许有一个通知单号!");
+            if (map.get(requirementNumber) != null) {
+                //已存在,修改
+                Map<String,Object> requirementMap =(Map<String, Object>) map.get(requirementNumber);
+                BigDecimal weight = DataChange.dataToBigDecimal(requirementMap.get("weight"));
+                BigDecimal truckNumber = DataChange.dataToBigDecimal(requirementMap.get("truckNumber"));
+                String loadTime = requirementMap.get("loadTime").toString();
+                List<Map<String,Object>> trainList = (ArrayList) requirementMap.get("trainList");
+                weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
+                truckNumber = truckNumber.add(new BigDecimal(1));
+                trainList.add(item);
+                requirementMap.put("weight", weight);
+                requirementMap.put("truckNumber", truckNumber);
+                requirementMap.put("trainList",trainList);
+                if(!loadTime.equals(item.get("装车日期").toString())){
+                    throw new Exception("同一个Excel只允许一批车辆,请检查装车日期!");
                 }
             } else {
                 //不存在,新增
+                Map<String,Object> requirementMap = new HashMap<>();
+                List<Map<String,Object>> trainList = new ArrayList<>();
+                trainList.add(item);
                 BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
                 BigDecimal truckNumber = new BigDecimal(1);
                 String loadTime = item.get("装车日期").toString();
-                map.put("requirementNumber", requirementNumber);
-                map.put("weight", weight);
-                map.put("truckNumber", truckNumber);
-                map.put("loadTime",loadTime);
+                if(loadDate == null){
+                    loadDate = loadTime;
+                    map.put("loadDate",loadDate);
+                }else if(!loadDate.equals(loadTime)){
+                    throw new Exception("同一个Excel只允许一批车辆,请检查装车日期!");
+                }
+                requirementMap.put("requirementNumber", requirementNumber);
+                requirementMap.put("weight", weight);
+                requirementMap.put("truckNumber", truckNumber);
+                requirementMap.put("loadTime",loadTime);
+                requirementMap.put("trainList",trainList);
+                requirementMap.put("userId",userId);
+                requirementMap.put("userName",userName);
+                requirementMap.put("businessType",businessType);
+                requirementList.add(requirementNumber);
+                map.put(requirementNumber, requirementMap);
             }
             //车牌号去重
             capacitySet.add(item.get("车号").toString());
@@ -478,26 +495,23 @@ public class TMSController extends BaseRESTfulController {
         }
         //新增火车运力资源
         String[] capacities = capacitySet.toArray(new String[0]);//车牌号
-        if (capacities.length != list.size()) {
-            throw new Exception("车号不允许重复!");
-        } else {
-            try{
-                new Runnable() {
-                    @Override
-                    public void run() {
-                        Map<String, Object> capacityMap = new HashMap<>();
-                        capacityMap.put("capacities", capacities);
-                        capacityMap.put("userId", userId);
-                        capacityMap.put("userName", userName);
-                        rmsFeign.batchInsertCapacityTrain(capacityMap);
-                    }
-                }.run();
-            }catch (Exception e){e.printStackTrace();}
-        }
+        try{
+            new Runnable() {
+                @Override
+                public void run() {
+                    Map<String, Object> capacityMap = new HashMap<>();
+                    capacityMap.put("capacities", capacities);
+                    capacityMap.put("userId", userId);
+                    capacityMap.put("userName", userName);
+                    rmsFeign.batchInsertCapacityTrain(capacityMap);
+                }
+            }.run();
+        }catch (Exception e){e.printStackTrace();}
         //新增AMS及TMS
         map.put("userId",userId);
         map.put("userName",userName);
         map.put("businessType",businessType);
+        map.put("requirementList",requirementList);
         return tmsFeign.purchaseTrainLoad(map);
     }
 
@@ -524,6 +538,7 @@ public class TMSController extends BaseRESTfulController {
         List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
         map.put("list", list);
         Set<String> capacitySet = new HashSet<>();//车牌号
+        String weightTime = null;
         for (Map<String, Object> item : list) {
             //校验行
             if(item.get("通知单号")==null || item.get("通知单号").equals("")
@@ -535,25 +550,10 @@ public class TMSController extends BaseRESTfulController {
                 throw new Exception("单元格数据异常(通知单号/车号/计量日期/净重/皮重/毛重),请检查模板或数据是否正确!");
             }
             //校验数据
-            String requirementNumber = item.get("通知单号").toString();
-            if (map.get("requirementNumber") != null) {
-                if (map.get("requirementNumber").equals(requirementNumber)) {
-                    String weightTime = map.get("weightTime").toString();
-                    if(!weightTime.equals(item.get("计量日期").toString())){
-                        throw new Exception("同一个Excel只允许一批车辆,请检查计量日期!");
-                    }
-                    //更新重量
-                    BigDecimal weight = DataChange.dataToBigDecimal(map.get("weight"));
-                    weight = weight.add(DataChange.dataToBigDecimal(item.get("净重")));
-                    map.put("weight", weight);
-                } else {
-                    throw new Exception("同一个Excel文件中只允许有一个通知单号!");
-                }
-            } else {
-                //不存在,新增
-                map.put("requirementNumber", requirementNumber);
-                map.put("weightTime",item.get("计量日期").toString());
-                map.put("weight",DataChange.dataToBigDecimal(item.get("净重")));
+            if(weightTime == null){
+                weightTime = item.get("计量日期").toString();
+            }else if(!weightTime.equals(item.get("计量日期").toString())){
+                throw new Exception("同一个Excel只允许一批车辆,请检查计量日期!");
             }
             //车牌号去重
             capacitySet.add(item.get("车号").toString());
@@ -566,19 +566,52 @@ public class TMSController extends BaseRESTfulController {
         map.put("userName",userName);
         map.put("businessType",businessType);
         //获取火车运单及计量详情
-        List<Map<String,Object>> orderList = universalMapper.findTrainWeight(map);
-        if (orderList.size() <= 0) {
+        List<Map<String,Object>> orderListAll = universalMapper.findTrainWeight(map);
+        if (orderListAll.size() <= 0) {
             throw new Exception("未查询到装车信息,请先上传装车作业!");
-        } else if(orderList.size() != universalMapper.countTransOrder(orderList.get(0))){
-            throw new Exception("计量信息与装车信息数量不一致,请重新上传!");
-        } else if(orderList.get(0).get("unloadResultId")!=null){
-            throw new Exception("车皮已卸车,不允许再上传计量!");
         }
-        map.put("orderList",orderList);
-        map.put("transPlanId",orderList.get(0).get("transPlanId"));
-        map.put("materialId",orderList.get(0).get("materialId"));
-        //新增TMS
-        return tmsFeign.purchaseTrainWeight(map);
+        List<String> requireList = new ArrayList<>();
+        for(Map<String,Object> order : orderListAll){
+            if(order.get("unloadResultId") != null){
+                throw new Exception(order.get("capacityId")+"已卸车,不允许再上传计量!");
+            }
+            String requireNumber = order.get("requireNumber").toString();
+            Map<String,Object> requirementMap =(Map<String, Object>) map.get(requireNumber);
+            if(requirementMap!=null){
+                List<Map<String,Object>> orderList = (ArrayList) requirementMap.get("orderList");
+                orderList.add(order);
+                BigDecimal weight = DataChange.dataToBigDecimal(requirementMap.get("weight"));
+                requirementMap.put("weight",weight.add(DataChange.dataToBigDecimal(order.get("netWeight"))));
+                requirementMap.put("orderList",orderList);
+            }else{
+                requirementMap = new HashMap<>();
+                List<Map<String,Object>> orderList = new ArrayList<>();
+                orderList.add(order);
+                BigDecimal weight = DataChange.dataToBigDecimal(order.get("netWeight"));
+                requirementMap.put("transPlanId",order.get("transPlanId"));
+                requirementMap.put("materialId",order.get("materialId"));
+                requirementMap.put("weight",weight);
+                requirementMap.put("weightTime",weightTime);
+                requirementMap.put("userId",userId);
+                requirementMap.put("userName",userName);
+                requirementMap.put("orderList",orderList);
+                requireList.add(requireNumber);
+            }
+            map.put(requireNumber,requirementMap);
+        }
+        Map<String,Object> result = null;
+        for(String requireNumber : requireList){
+            Map<String,Object> requirementMap =(Map<String, Object>) map.get(requireNumber);
+            List<Map<String,Object>> orderList = (ArrayList) requirementMap.get("orderList");
+            if(universalMapper.countTransOrder(requirementMap) != orderList.size()){
+                throw new Exception("计量车数与装车车数不一致!");
+            }
+            result = tmsFeign.purchaseTrainWeight(requirementMap);
+            if (!"succeed".equals(result.get("status"))) {
+                throw new Exception("计量上传失败:" + result.get("message"));
+            }
+        }
+        return result;
     }
 
 
@@ -604,6 +637,7 @@ public class TMSController extends BaseRESTfulController {
         List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
         map.put("list", list);
         Set<String> capacitySet = new HashSet<>();//车牌号
+        String unloadTime = null;
         for (Map<String, Object> item : list) {
             //校验行
             if(item.get("通知单号")==null || item.get("通知单号").equals("")
@@ -613,23 +647,10 @@ public class TMSController extends BaseRESTfulController {
                 throw new Exception("单元格数据异常(通知单号/车号/卸车日期/净重),请检查模板或数据是否正确!");
             }
             //校验数据
-            String requirementNumber = item.get("通知单号").toString();
-            BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
-            if (map.get("requirementNumber") != null) {
-                if (map.get("requirementNumber").equals(requirementNumber)) {
-                    String unloadTime = map.get("unloadTime").toString();
-                    if(!unloadTime.equals(item.get("卸车日期").toString())){
-                        throw new Exception("同一个Excel只允许一批车辆,请检查卸车日期!");
-                    }
-                } else {
-                    throw new Exception("同一个Excel文件中只允许有一个通知单号!");
-                }
-                map.put("weight", weight.add(DataChange.dataToBigDecimal(map.get("weight"))));
-            } else {
-                //不存在,新增
-                map.put("requirementNumber", requirementNumber);
-                map.put("weight", weight);
-                map.put("unloadTime",item.get("卸车日期").toString());
+            if(unloadTime == null){
+                unloadTime = item.get("卸车日期").toString();
+            }else if(!unloadTime.equals(item.get("卸车日期").toString())){
+                throw new Exception("同一个Excel只允许一批车辆,请检查卸车日期!");
             }
             //车牌号去重
             capacitySet.add(item.get("车号").toString());
@@ -642,26 +663,54 @@ public class TMSController extends BaseRESTfulController {
         map.put("userName",userName);
         map.put("businessType",businessType);
         //获取火车运单及计量详情
-        List<Map<String,Object>> orderList = universalMapper.findTrainUnload(map);
-        if (orderList.size() <= 0) {
+        List<Map<String,Object>> orderListAll = universalMapper.findTrainUnload(map);
+        if (orderListAll.size() <= 0) {
             throw new Exception("未查询到装车信息,请先上传装车作业!");
-        } else if(orderList.size() != universalMapper.countTransOrder(orderList.get(0))){
-            throw new Exception("卸货信息与装车信息数量不一致,请重新上传!");
         }
-        //获取原本重量之和
-        BigDecimal weightOld = BigDecimal.ZERO;
-        for(Map<String,Object> item : orderList){
-            weightOld = weightOld.add(DataChange.dataToBigDecimal(item.get("unloadWeightOld")));
+        List<String> requireList = new ArrayList<>();
+        for(Map<String,Object> order : orderListAll){
+            if(order.get("unloadResultId") != null){
+                throw new Exception(order.get("capacityId")+"已卸车,不允许再上传!");
+            }
+            String requireNumber = order.get("requireNumber").toString();
+            Map<String,Object> requirementMap =(Map<String, Object>) map.get(requireNumber);
+            if(requirementMap!=null){
+                List<Map<String,Object>> orderList = (ArrayList) requirementMap.get("orderList");
+                orderList.add(order);
+                BigDecimal weight = DataChange.dataToBigDecimal(requirementMap.get("weight"));
+                requirementMap.put("weight",weight.add(DataChange.dataToBigDecimal(order.get("unloadWeight"))));
+                requirementMap.put("orderList",orderList);
+            }else{
+                requirementMap = new HashMap<>();
+                List<Map<String,Object>> orderList = new ArrayList<>();
+                orderList.add(order);
+                BigDecimal weight = DataChange.dataToBigDecimal(order.get("unloadWeight"));
+                requirementMap.put("transPlanId",order.get("transPlanId"));
+                requirementMap.put("materialId",order.get("materialId"));
+                requirementMap.put("unloadPointId",order.get("unloadPointId"));
+                requirementMap.put("weight",weight);
+                requirementMap.put("unloadTime",unloadTime);
+                requirementMap.put("userId",userId);
+                requirementMap.put("userName",userName);
+                requirementMap.put("orderList",orderList);
+                requirementMap.put("requirementSerialNumber",requireNumber);
+                requireList.add(requireNumber);
+            }
+            map.put(requireNumber,requirementMap);
         }
-        map.put("weightOld",weightOld);
-        map.put("diff",DataChange.dataToBigDecimal(map.get("weight").toString()).subtract(weightOld));
-        map.put("orderList",orderList);
-        map.put("requirementSerialNumber",orderList.get(0).get("requirementSerialNumber"));
-        map.put("transPlanId",orderList.get(0).get("transPlanId"));
-        map.put("materialId",orderList.get(0).get("materialId"));
-        map.put("unloadPointId",orderList.get(0).get("unloadPointId"));
-        //新增TMS
-        return tmsFeign.purchaseTrainUnload(map);
+        Map<String,Object> result = null;
+        for(String requireNumber : requireList){
+            Map<String,Object> requirementMap =(Map<String, Object>) map.get(requireNumber);
+            List<Map<String,Object>> orderList = (ArrayList) requirementMap.get("orderList");
+            if(universalMapper.countTransOrder(requirementMap) != orderList.size()){
+                throw new Exception("卸车车数与装车车数不一致!");
+            }
+            result = tmsFeign.purchaseTrainUnload(requirementMap);
+            if (!"succeed".equals(result.get("status"))) {
+                throw new Exception("上传失败:" + result.get("message"));
+            }
+        }
+        return result;
     }
 
     @ApiOperation(value = "查询采购火运卸车")
@@ -779,4 +828,22 @@ public class TMSController extends BaseRESTfulController {
     RESTfulResult getDriverDayJobForApp(@RequestBody Map<String,Object> map,Integer apiId) {
         return tmsFeign.getDriverDayJobForApp(map,apiId);
     }
+
+    @ApiOperation(value = "确认出库", notes = "确认出库")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
+    })
+    @PostMapping(value = "/outBound")
+    public RESTfulResult outBound(@RequestBody Map<String, Object> map) {
+        return tmsFeign.outBound(map);
+    }
+
+    @ApiOperation(value = "撤销出库", notes = "撤销出库")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "map", value = "json格式具体参数", required = true, dataType = "Map<String,Object>")
+    })
+    @PostMapping(value = "/revokeOutBound")
+    public RESTfulResult revokeOutBound(@RequestBody Map<String, Object> map) {
+        return tmsFeign.revokeOutBound(map);
+    }
 }

+ 12 - 8
src/main/java/com/steerinfo/dil/controller/UniversalController.java

@@ -26,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 import static com.steerinfo.dil.util.EasyExcelUitl.exportExcelFile;
@@ -345,27 +346,30 @@ public class UniversalController extends BaseRESTfulController {
     @ApiOperation("通用导出")
     @PostMapping("/excleExport")
     public RESTfulResult excleExport(@RequestBody Map<String,Object> map) throws IOException {
-
         JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(map));
         jsonObject.putAll( JSONObject.parseObject(JSONObject.toJSONString(map.get("requestQuery"))));
-        JSONObject json = HttpUtil.sendPost("http://http://172.16.90.202:8083"+map.get("requestUrl").toString(),jsonObject);
-//        String jsonStr = getJsonData(jsonObject, "http://localhost:8080"+map.get("requestUrl").toString());
-//        JSONObject json = JSONObject.parseObject(jsonStr);
-        System.out.println(json);
+        String url  =  "http://172.16.90.202:80"+map.get("requestUrl").toString() + "&pageNum=1&pageSize=10000";
+        JSONObject json = HttpUtil.sendPost(url,jsonObject);
         Map<String, Object> data = (Map<String, Object>) json.get("data");
         String listStr = data.get("list").toString();
         String columnDataStr=data.get("columnData").toString();
-       List<Map<String,Object>> listMap = JSON.parseObject(listStr,new TypeReference<List<Map<String,Object>>>(){});
+        List<Map<String,Object>> listMap = JSON.parseObject(listStr,new TypeReference<List<Map<String,Object>>>(){});
         List<Map<String,Object>> columnData = JSON.parseObject(columnDataStr,new TypeReference<List<Map<String,Object>>>(){});
         LinkedHashMap<String, String> columnMaps = Maps.newLinkedHashMap();
         for (int i = 0; i <columnData.size() ; i++) {
             columnMaps.put(columnData.get(i).get("prop").toString(),columnData.get(i).get("label").toString());
         }
         byte[] stream1 = exportExcelFile(columnMaps, listMap);
-        FileOutputStream outputStream1 = new FileOutputStream(new File("C:/Users/Administrator/OneDrive/文档/"+map.get("exclename").toString()+".xlsx"));
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        String path = "/data/file/"+  map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx";
+        FileOutputStream outputStream1 = new FileOutputStream(new File(path));
         outputStream1.write(stream1);
+        outputStream1.flush();
         outputStream1.close();
-        return success();
+        Map<String, Object> response = new HashMap<>();
+        response.put("fileName",map.get("userName") + "-" + simpleDateFormat.format(new Date()) + "-" + map.get("exclename").toString() + ".xlsx");
+        response.put("filePath",path);
+        return success(response);
     }
 
 }

+ 3 - 3
src/main/java/com/steerinfo/dil/feign/AmsFeign.java

@@ -323,7 +323,8 @@ public interface AmsFeign {
 
     @PostMapping(value = "api/v1/ams/amstransrequirements/updateBalancePl")
     RESTfulResult updateBalancePl(@RequestBody Map<String, Object> map);
-    @PostMapping(value = "api/v1/ams/amsfixedneedss/fixedNeedsAdd")
+    @PostMapping(value = "api/v1/ams/amstransrequirements/addWMS")
+    RESTfulResult addWMS(@RequestBody Map<String, Object> map);  @PostMapping(value = "api/v1/ams/amsfixedneedss/fixedNeedsAdd")
     RESTfulResult fixedNeedsAdd(@RequestBody Map<String, Object> map);
 
     @PostMapping(value = "api/v1/ams/amsfixedneedss/getfixdNeedsList")
@@ -344,5 +345,4 @@ public interface AmsFeign {
 
 
     @PostMapping(value = "api/v1/ams/amsfixedneedss/readFixedNeedsExcel", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    Map<String, Object> readFixedNeedsExcel(MultipartFile file );
-}
+    Map<String, Object> readFixedNeedsExcel(MultipartFile file );}

+ 9 - 0
src/main/java/com/steerinfo/dil/feign/ReportFeign.java

@@ -48,4 +48,13 @@ public interface ReportFeign {
                                               @RequestParam Integer apiId,
                                               @RequestParam  Integer pageNum,
                                               @RequestParam  Integer pageSize);
+
+    @PostMapping(value = "api/v1/report/saleReports/getTransReportXG")
+    Map<String, Object> getTransReportXG(@RequestBody(required = false) HashMap<String, Object> map,
+                                              @RequestParam Integer apiId,
+                                              @RequestParam  Integer pageNum,
+                                              @RequestParam  Integer pageSize);
+
+    @PostMapping(value = "api/v1/report/saleReports/updateTransUnitPrice")
+    Map<String, Object> updateTransUnitPrice(HashMap<String, Object> map);
 }

+ 25 - 0
src/main/java/com/steerinfo/dil/feign/SSOFeign.java

@@ -49,6 +49,31 @@ public interface SSOFeign {
     JSONObject deleteUser(@RequestHeader("Authorization") String token,
                           @PathVariable String userId);
 
+
+    @PutMapping("/v1/sysusers/resetPassword/{userId}")
+    JSONObject resetPassword(@RequestHeader("Authorization") String token,
+                       @PathVariable String userId,
+                       @RequestParam String password,
+                       @RequestBody(required = true) Map<String,Object> map);
+
+    @PutMapping("/v1/sysuserlogins/resetLoginInfo/{userCode}")
+    JSONObject resetLoginInfo(@RequestHeader("Authorization") String token,
+                             @PathVariable String userCode);
+
+    /**
+     * 激活账号
+     * @param token
+     * @param userId
+     * @param status 1-启用
+     * @param loginStatus 1-激活
+     * @return
+     */
+    @PostMapping("/v1/sysusers/updateUser/{userId}")
+    JSONObject reActive(@RequestHeader("Authorization") String token,
+                              @PathVariable String userId,
+                              @RequestParam(defaultValue = "1") String status,
+                              @RequestParam(defaultValue = "1") String loginStatus);
+
     @GetMapping("/v1/sysroles/getRolesUser")
     JSONObject getRolesUser(@RequestHeader("Authorization") String token,
                        @RequestParam String companyId);

+ 6 - 0
src/main/java/com/steerinfo/dil/feign/TmsFeign.java

@@ -281,6 +281,12 @@ public interface TmsFeign {
 
     @PostMapping("api/v1/tms/omstransorders/getDriverDayJobForApp")
     RESTfulResult getDriverDayJobForApp(@RequestBody(required = false) Map<String, Object> map, @RequestParam Integer apiId);
+
+    @PostMapping(value = "api/v1/tms/omstransorders/outBound")
+    RESTfulResult outBound(@RequestBody Map<String, Object> map);
+
+    @PostMapping(value = "api/v1/tms/omstransorders/revokeOutBound")
+    RESTfulResult revokeOutBound(@RequestBody Map<String, Object> map);
 }
 
 

+ 39 - 1
src/main/java/com/steerinfo/dil/util/SSOUtil.java

@@ -41,7 +41,7 @@ public class SSOUtil {
     public  String login(){
         try{
             JSONObject result = ssoFeign.login(userName,password,"web");
-            String token = result.getJSONObject("data").getString("accessToken");
+            String token = "Bearer " + result.getJSONObject("data").getString("accessToken");
             log.debug(token);
             return  token;
         }catch (Exception e){
@@ -141,4 +141,42 @@ public class SSOUtil {
         }
         return new HashMap<>();
     }
+
+    /**
+     * 重置密码
+     * @param userId
+     * @return
+     */
+    public JSONObject resetPwd(String userId,String userCode) throws Exception {
+        String token = login();
+        if(token == null){
+            throw new Exception("登录SSO失败!");
+        }
+        Map<String,Object> params = new HashMap<>();
+        params.put("userId",userId);
+        params.put("password","At123456");
+        //重置密码
+        JSONObject result =  ssoFeign.resetPassword(token,userId,"At123456",params);
+        //解锁用户并激活账号
+        unlockUser(userId,userCode);
+        return result;
+    }
+
+
+    /**
+     * 解锁用户并激活账号
+     * @param userId
+     * @param userCode
+     * @return
+     * @throws Exception
+     */
+    public JSONObject unlockUser(String userId,String userCode) throws Exception {
+        String token = login();
+        if(token == null){
+            throw new Exception("登录SSO失败!");
+        }
+        JSONObject result =  ssoFeign.resetLoginInfo(token,userCode);//解锁用户
+        ssoFeign.reActive(token,userId,"1","1");//激活账户
+        return result;
+    }
 }

+ 3 - 5
src/main/resources/com/steerinfo/dil/mapper/BackgroundProcessingMapper.xml

@@ -30,7 +30,7 @@
             FROM RMS_PERSONNEL RP
                      LEFT JOIN RMS_PERSONNEL_COMPANY RPC ON RP.PERSONNEL_ID = RPC.PERSONNEL_ID
             WHERE RPC.DELETED = 0
-              AND RP.PERSONNEL_JOB_NUMBER = #{userName}
+              AND RP.SSO_ID = #{userId}
               AND nvl(RP.PERSONNEL_POST,'无') != '司机'
         )
         CONNECT BY PRIOR RC.COMPANY_ID = rc.PARENT_COMPANY_ID
@@ -38,9 +38,7 @@
         order by "level"
     </select>
     <select id="getCurrentCompanyList" resultType="java.util.Map">
-        SELECT distinct rc.company_id "companyId",
-                        rc.COMPANY_TYPE "companyType",
-                        rc.DELETED "deleted"
+        SELECT distinct rc.company_id "companyId"
         FROM RMS_PERSONNEL RP
         LEFT JOIN RMS_PERSONNEL_COMPANY RPC
         on RP.PERSONNEL_ID = RPC.PERSONNEL_ID
@@ -93,7 +91,7 @@
             RP.PERSONNEL_POST "personnelPost",
             RP.PERSONNEL_TEAM "personnelTeam"
         FROM RMS_PERSONNEL  RP
-        WHERE RP.DELETED = 0
+        WHERE RP.DELETED != -1
           AND RP.PERSONNEL_JOB_NUMBER = #{loginName}
         FETCH NEXT 1 ROWS ONLY
     </select>

+ 3 - 2
src/main/resources/com/steerinfo/dil/mapper/CommonMapper.xml

@@ -54,11 +54,12 @@
                         )
                     </when>
                     <when test="item == 'businessCompany'">
-                        "businessCompanyId"
-                        in
+                        "businessCompanyId" in(
+                        select COMPANY_ID from RMS_COMPANY where COMPANY_NAME in(select COMPANY_NAME FROM RMS_COMPANY where COMPANY_ID in
                         <foreach collection="dilCompanyList" open="(" close=")" separator="," item="item" index="index">
                             #{item.companyId}
                         </foreach>
+                        ))
                     </when>
                     <when test="item == 'approveBusinessCompany'">
                         "approveBusinessCompanyId"

+ 64 - 29
src/main/resources/com/steerinfo/dil/mapper/UniversalMapper.xml

@@ -160,7 +160,7 @@
 
             </where>
             <if test="noRow == null">
-                order by LENGTH(company_name)
+                order by rc.register_aptitudes,LENGTH(company_name)
             </if>
             )
             <where>
@@ -168,7 +168,6 @@
                 <include refid="com.steerinfo.dil.mapper.CommonMapper.filterCompanyData"></include>
             </if>
             </where>
-            ORDER BY to_number("seqNo")
             FETCH NEXT 10 ROWS ONLY
         )
         <if test="id!=null and id.size>0">
@@ -229,16 +228,19 @@
         select * from(
         select * from(
         select
-        MATERIAL_TYPE_ID "operationsNameId",
-        MATERIAL_TYPE_NAME "operationsName",
-        MATERIAL_TYPE_ID "id",
-        MATERIAL_TYPE_ID "value",
-        MATERIAL_TYPE_NAME "label",
-        MATERIAL_TYPE_NAME "text",
-        REMARK "remark",
+        t.MATERIAL_TYPE_ID "operationsNameId",
+        t.MATERIAL_TYPE_NAME "operationsName",
+        t.MATERIAL_TYPE_ID "id",
+        t.MATERIAL_TYPE_ID "value",
+        t.MATERIAL_TYPE_NAME "label",
+        t.MATERIAL_TYPE_NAME "text",
+        t.REMARK "remark",
+        t1.company_id "businessCompanyId",
         'operationsName' "prop"
-        from RMS_MATERIAL_TYPE
-        where DELETED = 0
+        from RMS_MATERIAL_TYPE t
+        left join rms_company_b_m_t t1
+        on t.material_type_id = t1.material_type_id
+        where t.DELETED = 0
         )
         <where>
             <if test="index!=null and index!=''">
@@ -250,6 +252,9 @@
             <if test="lastIndex!=null">
                 and "operationsNameId" &lt; #{lastIndex}
             </if>
+            <if test="companyType != null and companyType == '业务单位' and isListed == null">
+                <include refid="com.steerinfo.dil.mapper.CommonMapper.filterCompanyData"></include>
+            </if>
         </where>
         order by "operationsNameId" desc
         FETCH NEXT 10 ROWS ONLY
@@ -325,7 +330,7 @@
                 AND ALTERNATE_FIELDS1 = #{sourceFlag}
             </if>
         </where>
-        order by LENGTH(OPERATION_POINT_NAME)
+        order by alternate_fields3,LENGTH(OPERATION_POINT_NAME)
         FETCH NEXT 10 ROWS ONLY
         )
         <if test="id!=null and id.size>0">
@@ -341,7 +346,7 @@
                 #{item}
             </foreach>
         </if>
-      )  order by LENGTH("OPERATION_POINT_NAME")
+      )  order by LENGTH("OPERATION_POINT_NAME") desc
     </select>
 
     <select id="getPersonnelByLike" resultType="java.util.Map">
@@ -631,8 +636,10 @@
         else RCA.REMARK1
         end "capacityNumber",
         (case
+        when RCA.deleted = '3' then '维保'
         when oto.capacity_id is null then '空闲'
         when oto.deleted != '2' and oto.capacity_id is not null then '已派'
+        when oto.deleted = '2' and oto.capacity_id is not null then '空闲'
         end) "status",
         RCT.CAPACITY_TYPE_NAME "capacityTypeName",
         'capacityNumber' "prop"
@@ -665,11 +672,16 @@
         </if>
         WHERE RCA .DELETED = 0
         <if test="capacityTypeId !=null">
-            AND RCT.CAPACITY_TYPE_ID in (
-            select rct.capacity_type_id from rms_capacity_type rct
-            START WITH rct.capacity_type_id = #{capacityTypeId}
-            connect BY PRIOR rct.capacity_type_id = rct.p_capacity_type_id
-            )
+            AND (RCT.CAPACITY_TYPE_ID in (
+                select rct.capacity_type_id from rms_capacity_type rct
+                START WITH rct.capacity_type_id = #{capacityTypeId}
+                connect BY PRIOR rct.capacity_type_id = rct.p_capacity_type_id
+                )
+                or RCA.CAPACITY_TYPE_ID2 in (
+                select rct.capacity_type_id from rms_capacity_type rct
+                START WITH rct.capacity_type_id = #{capacityTypeId}
+                connect BY PRIOR rct.capacity_type_id = rct.p_capacity_type_id
+            ))
         </if>
         <if test="capacityType != null and capacityType != '' ">
             AND RCT.CAPACITY_TYPE_NAME = #{capacityType}
@@ -827,12 +839,15 @@
         rc.START_POINT_ID   "shippingPointId",
         rc.END_POINT_ID     "receivingPointId",
         rc.LINE_ID  "lineId",
+        t1.company_id "businessCompanyId",
         'operationRangeName' "prop"
         from RMS_TRANS_RANGE RC
         left join rms_operation_point rop_s
         on rop_s.operation_point_id = RC.start_point_id
         left join rms_operation_point rop_e
         on rop_e.operation_point_id = RC.end_point_id
+        left join rms_company_b_m_t t1
+        on RC.trans_range_id = t1.trans_range_id
         <where>
             and RC.DELETED = 0
             <if test="isNc!=null and isNc!=''">
@@ -842,6 +857,9 @@
         </where>
         )
         <where>
+            <if test="companyType != null and companyType == '业务单位' and isListed == null">
+                <include refid="com.steerinfo.dil.mapper.CommonMapper.filterCompanyData"></include>
+            </if>
             <if test="index!=null and index!=''">
                 <bind name="indexBind" value="'%' + index + '%'"/>
                 AND "label" like #{indexBind}
@@ -973,6 +991,7 @@
         RL.LINE_ID "value",
         RL.LINE_NAME "label",
         RL.LINE_NAME "text",
+        RL.REMARK "lineDesk",
         NVL(RL_TEMP."points",'无') "points",
 
         RL.LINE_TYPE    "lineType",
@@ -1003,6 +1022,9 @@
             <if test="lineType!=null and lineType!=''">
                 AND REGEXP_LIKE("lineType" , #{lineType})
             </if>
+            <if test="lastIndex!=null and lastIndex!=''">
+                AND 1!=1
+            </if>
         </where>
         FETCH NEXT 10 ROWS ONLY
         )
@@ -1015,6 +1037,7 @@
             RL.LINE_ID "value",
             RL.LINE_NAME "label",
             RL.LINE_NAME "text",
+            RL .REMARK "lineDesk",
             NVL(RL_TEMP."points",'无') "points",
             RL.LINE_TYPE    "lineType",
             'lineName' "prop"
@@ -1122,11 +1145,11 @@
         LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
         <where>
             OTO.DELETED != 1
-            AND ATR.SERIAL_NUMBER =#{requirementNumber}
-            AND TLR.LOAD_START_TIME = to_date(#{loadTime}, 'yyyymmdd')
-            AND OTO.CAPACITY_ID IN
-            <foreach collection="list" item="item"  open="(" close=")" separator="," >
-                #{item.车号}
+            AND TLR.LOAD_START_TIME = to_date(#{loadDate}, 'yyyymmdd')
+            AND
+            <foreach collection="list" item="item"  open="(" close=")" separator="OR" >
+                ATR.SERIAL_NUMBER = #{item.通知单号}
+                AND OTO.CAPACITY_ID = #{item.车号}
             </foreach>
         </where>
     </select>
@@ -1192,21 +1215,25 @@
             APC .MATERIAL_ID "materialId",
             TWR .RESULT_ID "resultId",
             TUR .RESULT_ID "unloadResultId",
+            #{item.通知单号} "requireNumber",
             #{item.车号} "capacityId",
             #{item.净重} "netWeight",
             #{item.皮重} "tareWeight",
             #{item.毛重} "grossWeight"
             FROM 	OMS_TRANS_ORDER OTO
             LEFT JOIN OMS_ORDER_CHILD OOC ON OOC .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
+            LEFT JOIN TMS_LOAD_RESULT TLR ON TLR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
             LEFT JOIN TMS_WEIGHT_RESULT TWR
-                ON TWR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TWR.NET_WEIGHT_TIME = to_date(#{weightTime}, 'yyyymmdd')
+                ON TWR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TWR.NET_WEIGHT_TIME = to_date(#{item.计量日期}, 'yyyymmdd')
             LEFT JOIN TMS_UNLOAD_RESULT TUR ON TUR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
             LEFT JOIN  AMS_PLAN_CHILD APC ON APC.PLAN_CHILD_ID = OOC.PLAN_CHILD_ID
             LEFT JOIN AMS_REQUIREMENT_CHILD ARC ON ARC.REQUIREMENT_CHILD_ID = APC.REQUIREMENT_CHILD_ID
             LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
             <where>
                 OTO.DELETED != 1
-                AND ATR.SERIAL_NUMBER =#{requirementNumber}
+                AND 7 >= TO_NUMBER (to_date(#{item.计量日期}, 'yyyymmdd') - TLR.LOAD_START_TIME)
+                AND TO_NUMBER (to_date(#{item.计量日期}, 'yyyymmdd') - TLR.LOAD_START_TIME) >= 0
+                AND ATR.SERIAL_NUMBER =#{item.通知单号}
                 AND OTO.CAPACITY_ID = #{item.车号}
             </where>
         </foreach>
@@ -1222,17 +1249,25 @@
             ARC .RECEIVING_POINT_ID "unloadPointId",
             APC .MATERIAL_ID "materialId",
             #{item.车号} "capacityId",
-            #{item.净重} "unloadWeight"
+            #{item.通知单号} "requireNumber",
+            CASE
+                WHEN TWR .NET_WEIGHT > 0 THEN TWR .NET_WEIGHT
+                ELSE TLR .ACTUAL_TONNAGE
+            END  "unloadWeight"
             FROM 	OMS_TRANS_ORDER OTO
             LEFT JOIN OMS_ORDER_CHILD OOC ON OOC .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
+            LEFT JOIN TMS_LOAD_RESULT TLR ON TLR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
+            LEFT JOIN TMS_WEIGHT_RESULT TWR ON TWR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
             LEFT JOIN TMS_UNLOAD_RESULT TUR
-            ON TUR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TUR.UNLOAD_START_TIME = to_date(#{unloadTime}, 'yyyymmdd')
+            ON TUR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TUR.UNLOAD_START_TIME = to_date(#{item.卸车日期}, 'yyyymmdd')
             LEFT JOIN  AMS_PLAN_CHILD APC ON APC.PLAN_CHILD_ID = OOC.PLAN_CHILD_ID
             LEFT JOIN AMS_REQUIREMENT_CHILD ARC ON ARC.REQUIREMENT_CHILD_ID = APC.REQUIREMENT_CHILD_ID
             LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
             <where>
                 OTO.DELETED != 1
-                AND ATR.SERIAL_NUMBER =#{requirementNumber}
+                AND 7 >= TO_NUMBER (to_date(#{item.卸车日期}, 'yyyymmdd') - TLR.LOAD_START_TIME)
+                AND TO_NUMBER (to_date(#{item.卸车日期}, 'yyyymmdd') - TLR.LOAD_START_TIME) >= 0
+                AND ATR.SERIAL_NUMBER =#{item.通知单号}
                 AND OTO.CAPACITY_ID = #{item.车号}
             </where>
         </foreach>
@@ -1612,7 +1647,7 @@
             GROUP BY DRIVER_ID
             ) T ON T."driverId" = RP .PERSONNEL_ID
         </if>
-        WHERE RP.DELETED = 0
+        WHERE RP.DELETED != -1
         <if test="isNC!=null">
             AND RP.SOURCE_ID IS NOT NULL
         </if>