|
@@ -53,7 +53,7 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
|
|
|
|
|
|
/**
|
|
|
* 派单时新增进厂实绩
|
|
|
- * map: 总实绩Id、线路起点
|
|
|
+ * map: 总实绩Id、线路Id、路段顺序号
|
|
|
* @param map
|
|
|
* @return
|
|
|
*/
|
|
@@ -61,16 +61,14 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
|
|
|
public int addEnFactoryResult(Map<String, Object> map) {
|
|
|
TmstruckEnfactoryResult tmstruckEnfactoryResult = new TmstruckEnfactoryResult();
|
|
|
BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
|
|
|
- //生成进厂作业主键Id
|
|
|
+ tmstruckEnfactoryResult.setResultTotalId(resultTotalId);
|
|
|
//添加主键
|
|
|
tmstruckEnfactoryResult.setResultId(tmstruckEnfactoryResultMapper.selectMaxId());
|
|
|
- //通过总实绩ID查询订单类型
|
|
|
- Map<String, Object> mesMap = utilsMapper.getOrderTypeByTotalId(resultTotalId);
|
|
|
- int gatepostId = rulesService.calculateDxGatepostId(mesMap);
|
|
|
- //添加门岗ID
|
|
|
+ List<Integer> gatepostIdList = utilsMapper.getLineSegmentGateCalcId(map);
|
|
|
+ //随机取门岗Id
|
|
|
+ Integer gatepostId = utilsService.randomGetValue(gatepostIdList);
|
|
|
+ //获取门岗ID
|
|
|
tmstruckEnfactoryResult.setGatepostId(new BigDecimal(gatepostId));
|
|
|
- //添加实绩总表Id
|
|
|
- tmstruckEnfactoryResult.setResultTotalId(resultTotalId);
|
|
|
// 添加路段顺序号
|
|
|
tmstruckEnfactoryResult.setSegmenSqe(DataChange.dataToBigDecimal(map.get("segmentSqe")));
|
|
|
return tmstruckEnfactoryResultMapper.insertSelective(tmstruckEnfactoryResult);
|
|
@@ -160,47 +158,18 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
|
|
|
int checkMeasureCommission = 0;
|
|
|
switch (orderType.intValue()){
|
|
|
case 1:
|
|
|
- case 4:
|
|
|
//查询未装车实绩
|
|
|
List<Map<String, Object>> mapList = rulesService.judgeLastMaterial(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
- if(mapList.size() == 1){
|
|
|
- //如果是单拼 不需要走计算 直接走钢材的汽车衡(钢材)
|
|
|
- Map<String, Object> mesMap = new HashMap<>();
|
|
|
- mesMap.put("materialId",mapList.get(0).get("materialId"));
|
|
|
- map.put("materialId", mapList.get(0).get("materialId"));
|
|
|
- mesMap.put("nature", 1);
|
|
|
- mesMap.put("orderId", orderId);
|
|
|
- mesMap.put("orderType", orderType);
|
|
|
- //计算计皮汽车衡
|
|
|
- int tarePlaceId = rulesService.calculateWeighbridge(mesMap);
|
|
|
- mesMap.put("tarePlaceId", tarePlaceId);
|
|
|
- //更新汽车衡
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(mesMap);
|
|
|
- }else {
|
|
|
- //如果是多拼
|
|
|
- Map<String, Object> mesMap = rulesService.calculateMaterial(mapList);
|
|
|
- //获取物资ID
|
|
|
- HashMap<String, Object> calculateMap = new HashMap<>();
|
|
|
- calculateMap.put("orderId", map.get("orderId"));
|
|
|
- calculateMap.put("materialId", mesMap.get("materialId"));
|
|
|
- calculateMap.put("nature", 1); // 1:进厂秤
|
|
|
- //计算计皮汽车衡
|
|
|
- int tarePlaceId = rulesService.calculateWeighbridge(calculateMap);
|
|
|
- calculateMap.put("tarePlaceId", tarePlaceId);
|
|
|
- //更新汽车衡
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(calculateMap);
|
|
|
- }
|
|
|
+ map.put("materialId", mapList.get(0).get("materialId"));
|
|
|
checkMeasureCommission = tmstruckMeasureCommissionService.addXSMeasureCommission(map); //添加计皮委托
|
|
|
break;
|
|
|
+ case 4:
|
|
|
+ break;
|
|
|
case 2:
|
|
|
case 3:
|
|
|
- Map<String, Object> mesMap = new HashMap<>();
|
|
|
- mesMap.put("orderId", orderId);
|
|
|
- mesMap.put("orderType", orderType);
|
|
|
- int tarePlaceId = rulesService.calculateWeighbridge(mesMap);
|
|
|
- mesMap.put("tarePlaceId", tarePlaceId);
|
|
|
- //更新汽车衡
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(mesMap);
|
|
|
+ //通过物资ID查询订单ID(针对单拼)
|
|
|
+ List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(orderId);
|
|
|
+ map.put("materialId", materialIdList.get(0));
|
|
|
checkMeasureCommission = tmstruckMeasureCommissionService.addXSMeasureCommission(map); //添加计皮委托
|
|
|
break;
|
|
|
case 5:
|
|
@@ -210,31 +179,12 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
|
|
|
case 9:
|
|
|
case 17:
|
|
|
case 18:
|
|
|
- //计算计毛汽车衡并更新计量实绩 (暂时无法计算汽车衡) 需要写一个单独的方法 先计皮再计毛的
|
|
|
- HashMap<String, Object> calculateMap56789 = new HashMap<>();
|
|
|
- calculateMap56789.put("orderId", map.get("orderId"));
|
|
|
- calculateMap56789.put("orderType", orderType);
|
|
|
- //计算计量汽车衡
|
|
|
- int grossPlaceId = rulesService.calculateWeighbridge(calculateMap56789);
|
|
|
- calculateMap56789.put("grossPlaceId", grossPlaceId);
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(calculateMap56789);
|
|
|
//通过订单ID查询物资Id
|
|
|
- List<Integer> materialIdList = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
- map.put("materialId", materialIdList.get(0));
|
|
|
+ List<Integer> materialIds = utilsMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
+ map.put("materialId", materialIds.get(0));
|
|
|
checkMeasureCommission = tmstruckMeasureCommissionService.addMaoMeasureCommission(map); //添加计毛委托 并发送计毛委托
|
|
|
break;
|
|
|
case 10:
|
|
|
- HashMap<String, Object> calculateMap10 = new HashMap<>();
|
|
|
- calculateMap10.put("orderId", map.get("orderId"));
|
|
|
- calculateMap10.put("orderType", orderType);
|
|
|
- //计算计量汽车衡并更新计量实绩
|
|
|
- int placeId = rulesService.calculateWeighbridge(calculateMap10);
|
|
|
- if(placeId == 15){ //第一次计量
|
|
|
- calculateMap10.put("tarePlaceId", placeId); //皮重
|
|
|
- }else {
|
|
|
- calculateMap10.put("grossPlaceId", placeId); //毛重
|
|
|
- }
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(calculateMap10);
|
|
|
checkMeasureCommission = tmstruckMeasureCommissionService.addMaoMeasureCommission(map); //添加计量委托
|
|
|
break;
|
|
|
case 11:
|
|
@@ -243,25 +193,11 @@ public class TmstruckEnfactoryResultServiceImpl implements ITmstruckEnfactoryRes
|
|
|
case 13:
|
|
|
case 16:
|
|
|
case 15:
|
|
|
- //无法确定汽车衡
|
|
|
- HashMap<String, Object> calculateMap1213 = new HashMap<>();
|
|
|
- calculateMap1213.put("orderId", map.get("orderId"));
|
|
|
- calculateMap1213.put("orderType", orderType);
|
|
|
- //计算计量汽车衡并更新计量实绩
|
|
|
- int placeId1213 = rulesService.calculateWeighbridge(calculateMap1213);
|
|
|
- if(orderType.intValue() == 12){
|
|
|
- calculateMap1213.put("grossPlaceId", placeId1213);
|
|
|
- }else {
|
|
|
- calculateMap1213.put("tarePlaceId", placeId1213);
|
|
|
- }
|
|
|
- i += tmstruckWeightResultService.updateWeightResult(calculateMap1213);
|
|
|
//发送计量委托(查询物资顺序第一个装卸货的物资)
|
|
|
//拿到需要计量的物资ID
|
|
|
Integer materialId = utilsMapper.getLxFirstMaterialId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
map.put("materialId", materialId);
|
|
|
checkMeasureCommission += tmstruckMeasureCommissionService.addLXMeasureCommission(map);
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if(checkMeasureCommission == 0){
|