|
@@ -258,38 +258,64 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
//1.通过车号去寻找正在作业的5的运输订单号
|
|
//1.通过车号去寻找正在作业的5的运输订单号
|
|
String carNo = (String) map.get("carNo");
|
|
String carNo = (String) map.get("carNo");
|
|
//String FLID = (String) map.get("FLID");
|
|
//String FLID = (String) map.get("FLID");
|
|
- //不能影响皮重
|
|
|
|
- Map<String,Object> orderMes = tmstruckWeightResultMapper.getOrderMes(carNo);
|
|
|
|
- if (orderMes == null){
|
|
|
|
- Object FLID = map.get("FLID");
|
|
|
|
- if(FLID != null && !"".equals(FLID)) {
|
|
|
|
- //存在分录id,说明有整条数据,且该车又没有正在运行中的信息,那么就去找该分录id对应的运单的信息
|
|
|
|
- BigDecimal orderIdByFLID = omstruckOrderMapper.selectOrderIdByFLID(FLID);
|
|
|
|
- if(orderIdByFLID != null) {
|
|
|
|
- Map<String,Object> orderMesByFLIDMap = tmstruckWeightResultMapper.getOrderMesByOrderId(orderIdByFLID);
|
|
|
|
- if(orderMesByFLIDMap != null) {
|
|
|
|
- map.putAll(orderMesByFLIDMap);
|
|
|
|
- }else{
|
|
|
|
- throw new Exception("没有可进行填充的计量实绩");
|
|
|
|
- }
|
|
|
|
|
|
+ Object resultNetWeight = map.get("resultNetWeight");
|
|
|
|
+ Object FLID = map.get("FLID");
|
|
|
|
+ //判断该车有没有净重
|
|
|
|
+ if (resultNetWeight != null && !"".equals(resultNetWeight) && FLID != null && !"".equals(FLID)) {
|
|
|
|
+ String flId = FLID.toString();
|
|
|
|
+ map.put("flId",flId);
|
|
|
|
+ BigDecimal orderIdByFLID = omstruckOrderMapper.selectOrderIdByFLID(FLID);
|
|
|
|
+ BigDecimal saleMaterialId = tmstruckWeightResultMapper.getSaleMaterialId(map);
|
|
|
|
+ //首先判断该分录有没有净重
|
|
|
|
+ Map<String,Object> orderMesBySaleMaterialId = tmstruckWeightResultMapper.getOrderMesBySaleMaterialIdHaveWeight(saleMaterialId);
|
|
|
|
+ if(orderMesBySaleMaterialId == null) {
|
|
|
|
+ //根据分录id和车号去找
|
|
|
|
+ Map<String,Object> orderMesByOrderIdByFLID = tmstruckWeightResultMapper.getOrderMesBySaleMaterialId(orderIdByFLID);
|
|
|
|
+ if(orderMesByOrderIdByFLID != null) {
|
|
|
|
+ map.putAll(orderMesByOrderIdByFLID);
|
|
|
|
+ map.put("saleMaterialId",saleMaterialId);
|
|
}else{
|
|
}else{
|
|
- throw new Exception("该分录没有对应的订单");
|
|
|
|
|
|
+ throw new Exception("该分录对应的订单没有净重可供填充!");
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- throw new Exception("没有正在运行中的订单");
|
|
|
|
|
|
+ map.putAll(orderMesBySaleMaterialId);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ Map<String,Object> orderMes = tmstruckWeightResultMapper.getOrderMes(carNo);
|
|
|
|
+ if (orderMes == null) {
|
|
|
|
+ throw new Exception("该车无分录ID且无正在运行中的订单,系统无法匹配数据");
|
|
}
|
|
}
|
|
|
|
+ map.putAll(orderMes);
|
|
}
|
|
}
|
|
- map.putAll(orderMes);
|
|
|
|
|
|
+ //不能影响皮重
|
|
|
|
+ //if (orderMes == null){
|
|
|
|
+ // Object FLID = map.get("FLID");
|
|
|
|
+ // if(FLID != null && !"".equals(FLID)) {
|
|
|
|
+ // //存在分录id,说明有整条数据,且该车又没有正在运行中的信息,那么就去找该分录id对应的运单的信息
|
|
|
|
+ // BigDecimal orderIdByFLID = omstruckOrderMapper.selectOrderIdByFLID(FLID);
|
|
|
|
+ // if(orderIdByFLID != null) {
|
|
|
|
+ // Map<String,Object> orderMesByFLIDMap = tmstruckWeightResultMapper.getOrderMesByOrderId(orderIdByFLID);
|
|
|
|
+ // if(orderMesByFLIDMap != null) {
|
|
|
|
+ // map.putAll(orderMesByFLIDMap);
|
|
|
|
+ // }else{
|
|
|
|
+ // Map<String,Object> orderMesByFLIDMapNoWeight = tmstruckWeightResultMapper.getOrderMesByOrderIdNoWeight(orderIdByFLID);
|
|
|
|
+ // throw new Exception("没有可进行填充的计量实绩");
|
|
|
|
+ // }
|
|
|
|
+ // }else{
|
|
|
|
+ // throw new Exception("该分录没有对应的订单");
|
|
|
|
+ // }
|
|
|
|
+ // }else{
|
|
|
|
+ // throw new Exception("没有正在运行中的订单");
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
- int orderType = DataChange.dataToBigDecimal(orderMes.get("orderTypee")).intValue();
|
|
|
|
|
|
+ int orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
//磅单号
|
|
//磅单号
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
if(map.get("orderNumber") != null) {
|
|
if(map.get("orderNumber") != null) {
|
|
tmstruckWeightResult.setInsertUpdateRemark((String)map.get("orderNumber"));
|
|
tmstruckWeightResult.setInsertUpdateRemark((String)map.get("orderNumber"));
|
|
}
|
|
}
|
|
- //根据传输过来的物资名称和规格型号
|
|
|
|
- Object resultNetWeight = map.get("resultNetWeight");
|
|
|
|
if(resultNetWeight != null && !"".equals(resultNetWeight)) {
|
|
if(resultNetWeight != null && !"".equals(resultNetWeight)) {
|
|
BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
|
|
BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
|
|
if(materialId == null){
|
|
if(materialId == null){
|
|
@@ -312,6 +338,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
//}
|
|
//}
|
|
tmstruckWeightResult.setMaterialId(materialId);
|
|
tmstruckWeightResult.setMaterialId(materialId);
|
|
tmstruckWeightResult.setMaterialNum(DataChange.dataToBigDecimal(map.get("goodNum")));
|
|
tmstruckWeightResult.setMaterialNum(DataChange.dataToBigDecimal(map.get("goodNum")));
|
|
|
|
+ if(map.get("saleMaterialId") != null) {
|
|
|
|
+ tmstruckWeightResult.setSaleMaterialId(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
|
|
|
|
+ }
|
|
BigDecimal materialNum = DataChange.dataToBigDecimal(map.get("goodNum"));
|
|
BigDecimal materialNum = DataChange.dataToBigDecimal(map.get("goodNum"));
|
|
//通过订单ID和物资id,查询当单个物资的理重方便后续计算
|
|
//通过订单ID和物资id,查询当单个物资的理重方便后续计算
|
|
Map<String, Object> saleMaterialMes = tmstruckWeightResultMapper.getSaleOrderMaterialNum(map);
|
|
Map<String, Object> saleMaterialMes = tmstruckWeightResultMapper.getSaleOrderMaterialNum(map);
|
|
@@ -338,6 +367,8 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
}
|
|
}
|
|
tmstruckWeightResultMapper.updateOrderMaterial(map);
|
|
tmstruckWeightResultMapper.updateOrderMaterial(map);
|
|
tmstruckWeightResultMapper.updateSaleMaterialId(saleMaterialId,materialNum,newWeight);
|
|
tmstruckWeightResultMapper.updateSaleMaterialId(saleMaterialId,materialNum,newWeight);
|
|
|
|
+ //去掉该实绩下没有净重的有分录id的
|
|
|
|
+ tmstruckWeightResultMapper.updateQuitSaleMaterialId(map);
|
|
}else{
|
|
}else{
|
|
//根据运单id查询其中一个物资id,确保报表能有数据
|
|
//根据运单id查询其中一个物资id,确保报表能有数据
|
|
//查询没有净重的,不影响之前代码
|
|
//查询没有净重的,不影响之前代码
|