|
|
@@ -526,6 +526,10 @@ public class TMSController extends BaseRESTfulController {
|
|
|
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文件中只允许有一个通知单号!");
|
|
|
}
|
|
|
@@ -533,6 +537,7 @@ public class TMSController extends BaseRESTfulController {
|
|
|
//不存在,新增
|
|
|
map.put("requirementNumber", requirementNumber);
|
|
|
map.put("weightTime",item.get("计量日期").toString());
|
|
|
+ map.put("weight",DataChange.dataToBigDecimal(item.get("净重")));
|
|
|
}
|
|
|
//车牌号去重
|
|
|
capacitySet.add(item.get("车号").toString());
|
|
|
@@ -548,8 +553,14 @@ public class TMSController extends BaseRESTfulController {
|
|
|
List<Map<String,Object>> orderList = universalMapper.findTrainWeight(map);
|
|
|
if (orderList.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);
|
|
|
}
|
|
|
@@ -618,8 +629,21 @@ public class TMSController extends BaseRESTfulController {
|
|
|
List<Map<String,Object>> orderList = universalMapper.findTrainUnload(map);
|
|
|
if (orderList.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")));
|
|
|
}
|
|
|
+ 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);
|
|
|
}
|