|
@@ -13,6 +13,7 @@ import com.steerinfo.framework.controller.RESTfulResult;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import oracle.jdbc.proxy.annotation.Post;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -431,43 +432,62 @@ public class TMSController extends BaseRESTfulController {
|
|
|
map.put("list", list);
|
|
map.put("list", list);
|
|
|
//统计通知单的重量车数和车牌号
|
|
//统计通知单的重量车数和车牌号
|
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
|
|
+ List<String> requirementList = new ArrayList<>();
|
|
|
|
|
+ String loadDate = null;
|
|
|
for (Map<String, Object> item : list) {
|
|
for (Map<String, Object> item : list) {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|
|
|
+ || item.get("发站")==null || item.get("发站").equals("")
|
|
|
|
|
+ || item.get("到站")==null || item.get("到站").equals("")
|
|
|
|| item.get("装车日期")==null || item.get("装车日期").equals("")
|
|
|| item.get("装车日期")==null || item.get("装车日期").equals("")
|
|
|
- || item.get("净重")==null || item.get("净重").equals("")
|
|
|
|
|
|| item.get("皮重")==null || item.get("皮重").equals("")
|
|
|| item.get("皮重")==null || item.get("皮重").equals("")
|
|
|
|| item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|| item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|
- throw new Exception("单元格数据异常(通知单号/车号/装车日期/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
|
|
|
|
|
+ throw new Exception("单元格数据异常(通知单号/车号/装车日期/发站/到站/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
|
|
+ item.put("净重", DataChange.dataToBigDecimal(item.get("毛重")).subtract(DataChange.dataToBigDecimal(item.get("皮重"))));
|
|
|
//通知单统计
|
|
//通知单统计
|
|
|
String requirementNumber = item.get("通知单号").toString();
|
|
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 {
|
|
} else {
|
|
|
//不存在,新增
|
|
//不存在,新增
|
|
|
|
|
+ Map<String,Object> requirementMap = new HashMap<>();
|
|
|
|
|
+ List<Map<String,Object>> trainList = new ArrayList<>();
|
|
|
|
|
+ trainList.add(item);
|
|
|
BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
|
|
BigDecimal weight = DataChange.dataToBigDecimal(item.get("净重"));
|
|
|
BigDecimal truckNumber = new BigDecimal(1);
|
|
BigDecimal truckNumber = new BigDecimal(1);
|
|
|
String loadTime = item.get("装车日期").toString();
|
|
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());
|
|
capacitySet.add(item.get("车号").toString());
|
|
@@ -478,26 +498,23 @@ public class TMSController extends BaseRESTfulController {
|
|
|
}
|
|
}
|
|
|
//新增火车运力资源
|
|
//新增火车运力资源
|
|
|
String[] capacities = capacitySet.toArray(new String[0]);//车牌号
|
|
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
|
|
//新增AMS及TMS
|
|
|
map.put("userId",userId);
|
|
map.put("userId",userId);
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
map.put("businessType",businessType);
|
|
map.put("businessType",businessType);
|
|
|
|
|
+ map.put("requirementList",requirementList);
|
|
|
return tmsFeign.purchaseTrainLoad(map);
|
|
return tmsFeign.purchaseTrainLoad(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -511,6 +528,27 @@ public class TMSController extends BaseRESTfulController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "查询采购火运装货报表")
|
|
|
|
|
+ @PostMapping("/purchaseTrainLoadReport")
|
|
|
|
|
+ public Map<String, Object> purchaseTrainLoadReport(@RequestBody(required = false) Map<String, Object> map,
|
|
|
|
|
+ Integer apiId,
|
|
|
|
|
+ Integer pageNum,
|
|
|
|
|
+ Integer pageSize) {
|
|
|
|
|
+ return tmsFeign.purchaseTrainLoadReport(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "修改火运装车")
|
|
|
|
|
+ @PostMapping("/updateTrainLoad")
|
|
|
|
|
+ public Map<String, Object> updateTrainLoad(@RequestBody(required = false) Map<String, Object> map){
|
|
|
|
|
+ return tmsFeign.updateTrainLoad(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "修改火运装车序号")
|
|
|
|
|
+ @PostMapping("/updateTrainLoadSeq")
|
|
|
|
|
+ public Map<String, Object> updateTrainLoadSeq(@RequestBody(required = false) Map<String, Object> map){
|
|
|
|
|
+ return tmsFeign.updateTrainLoadSeq(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "采购火运计量作业")
|
|
@ApiOperation(value = "采购火运计量作业")
|
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
@ApiImplicitParam(name = "map", value = "JSON格式数据", required = true, dataType = "Map<String, Object>")
|
|
|
@PostMapping(value = "/purchaseTrainWeight")
|
|
@PostMapping(value = "/purchaseTrainWeight")
|
|
@@ -524,37 +562,23 @@ public class TMSController extends BaseRESTfulController {
|
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
map.put("list", list);
|
|
map.put("list", list);
|
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
|
|
+ String weightTime = null;
|
|
|
for (Map<String, Object> item : list) {
|
|
for (Map<String, Object> item : list) {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|
|| item.get("计量日期")==null || item.get("计量日期").equals("")
|
|
|| item.get("计量日期")==null || item.get("计量日期").equals("")
|
|
|
- || item.get("净重")==null || item.get("净重").equals("")
|
|
|
|
|
|| item.get("皮重")==null || item.get("皮重").equals("")
|
|
|| item.get("皮重")==null || item.get("皮重").equals("")
|
|
|
|| item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|| item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|
throw new Exception("单元格数据异常(通知单号/车号/计量日期/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
throw new Exception("单元格数据异常(通知单号/车号/计量日期/净重/皮重/毛重),请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
|
|
+ item.put("净重", DataChange.dataToBigDecimal(item.get("毛重")).subtract(DataChange.dataToBigDecimal(item.get("皮重"))));
|
|
|
//校验数据
|
|
//校验数据
|
|
|
- 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());
|
|
capacitySet.add(item.get("车号").toString());
|
|
|
}
|
|
}
|
|
@@ -566,19 +590,52 @@ public class TMSController extends BaseRESTfulController {
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
map.put("businessType",businessType);
|
|
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("未查询到装车信息,请先上传装车作业!");
|
|
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,33 +661,23 @@ public class TMSController extends BaseRESTfulController {
|
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
map.put("list", list);
|
|
map.put("list", list);
|
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
Set<String> capacitySet = new HashSet<>();//车牌号
|
|
|
|
|
+ String unloadTime = null;
|
|
|
for (Map<String, Object> item : list) {
|
|
for (Map<String, Object> item : list) {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
if(item.get("通知单号")==null || item.get("通知单号").equals("")
|
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|| item.get("车号")==null || item.get("车号").equals("")
|
|
|
|| item.get("卸车日期")==null || item.get("卸车日期").equals("")
|
|
|| item.get("卸车日期")==null || item.get("卸车日期").equals("")
|
|
|
- || item.get("净重")==null || item.get("净重").equals("")){
|
|
|
|
|
|
|
+ || item.get("皮重")==null || item.get("皮重").equals("")
|
|
|
|
|
+ || item.get("毛重")==null || item.get("毛重").equals("")){
|
|
|
throw new Exception("单元格数据异常(通知单号/车号/卸车日期/净重),请检查模板或数据是否正确!");
|
|
throw new Exception("单元格数据异常(通知单号/车号/卸车日期/净重),请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
|
|
+ item.put("净重", DataChange.dataToBigDecimal(item.get("毛重")).subtract(DataChange.dataToBigDecimal(item.get("皮重"))));
|
|
|
//校验数据
|
|
//校验数据
|
|
|
- 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());
|
|
capacitySet.add(item.get("车号").toString());
|
|
|
}
|
|
}
|
|
@@ -642,26 +689,50 @@ public class TMSController extends BaseRESTfulController {
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
map.put("businessType",businessType);
|
|
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("未查询到装车信息,请先上传装车作业!");
|
|
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);
|
|
|
|
|
+ requirementMap.put("orderList",orderList);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ requirementMap = new HashMap<>();
|
|
|
|
|
+ List<Map<String,Object>> orderList = new ArrayList<>();
|
|
|
|
|
+ orderList.add(order);
|
|
|
|
|
+ requirementMap.put("transPlanId",order.get("transPlanId"));
|
|
|
|
|
+ requirementMap.put("materialId",order.get("materialId"));
|
|
|
|
|
+ requirementMap.put("unloadPointId",order.get("unloadPointId"));
|
|
|
|
|
+ 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<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"));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- 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);
|
|
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "查询采购火运卸车")
|
|
@ApiOperation(value = "查询采购火运卸车")
|
|
@@ -797,4 +868,20 @@ public class TMSController extends BaseRESTfulController {
|
|
|
public RESTfulResult revokeOutBound(@RequestBody Map<String, Object> map) {
|
|
public RESTfulResult revokeOutBound(@RequestBody Map<String, Object> map) {
|
|
|
return tmsFeign.revokeOutBound(map);
|
|
return tmsFeign.revokeOutBound(map);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "查询车辆登记单信息")
|
|
|
|
|
+ @PostMapping("/likeTransitOrders")
|
|
|
|
|
+ public Map<String, Object> likeTransitOrders(@RequestBody(required = false) Map<String, Object> map,
|
|
|
|
|
+ Integer apiId,
|
|
|
|
|
+ Integer pageNum,
|
|
|
|
|
+ Integer pageSize) {
|
|
|
|
|
+ return tmsFeign.likeTransitOrders(map == null ? new HashMap<>() : map, apiId, pageNum, pageSize);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "新增车辆登记单信息")
|
|
|
|
|
+ @PostMapping("/insertTmsTransitOrder")
|
|
|
|
|
+ public Map<String,Object> insertTmsTransitOrder(@RequestBody Map<String,Object> map) {
|
|
|
|
|
+ return tmsFeign.insertTmsTransitOrder(map);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|