|
@@ -346,33 +346,79 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改火运装车实绩
|
|
* 修改火运装车实绩
|
|
- * @param tmstrainLoadingResult
|
|
|
|
|
|
+ * @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public int updateTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult) throws Exception{
|
|
|
|
- String wagonNo=tmstrainLoadingResult.getResultWagonNo();
|
|
|
|
- if(wagonNo!=null && wagonNo.length()!=7){
|
|
|
|
- throw new Exception("车皮号异常");
|
|
|
|
|
|
+ public int updateTmstrainLoadingResult(Map<String,Object> map) throws Exception{
|
|
|
|
+ TmstrainLoadingResult tmstrainLoadingResult=new TmstrainLoadingResult();
|
|
|
|
+ String wagonNo=map.get("resultWagonNo").toString();
|
|
|
|
+ BigDecimal resultId=DataChange.dataToBigDecimal(map.get("resultId"));
|
|
|
|
+ Integer resultType=(Integer) map.get("resultType");
|
|
|
|
+ if(wagonNo==null || wagonNo.length()!=7 || calculateWagonWeight(wagonNo)<=0){
|
|
|
|
+ return -1;
|
|
|
|
+ }else if(resultId==null){
|
|
|
|
+ return -2;
|
|
|
|
+ }else if(resultType==0){
|
|
|
|
+ return -3;
|
|
}
|
|
}
|
|
- //通过采购订单号获得批次ID
|
|
|
|
- BigDecimal purchaseOrderId = tmstrainLoadingResult.getPurchaseOrderRailPlanId();
|
|
|
|
- BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderId(purchaseOrderId);
|
|
|
|
- tmstrainLoadingResult.setBatchId(batchId);
|
|
|
|
- System.out.println(tmstrainLoadingResult);
|
|
|
|
- //新增完成,发送计量委托
|
|
|
|
-// if(resultIdList.size()==wagonNoList.size())
|
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
|
-// map.put("resultIdList",resultIdList);
|
|
|
|
-// int i = tmstrainMeasureCommissionService.batchSendMeasureCommission(map);
|
|
|
|
-// if(i==-1){
|
|
|
|
-// return i;
|
|
|
|
-// }
|
|
|
|
-// }else{
|
|
|
|
-// return -1;
|
|
|
|
-// }
|
|
|
|
|
|
+ //国产矿未配单仅支持修改部分字段,并且不重新发委托
|
|
|
|
+ List<Map<String,Object>> results=tmstrainLoadingResultMapper.selectByResultId(resultId);
|
|
|
|
+ if(resultType==3 && results!=null && results.get(0)!=null && results.get(0).get("purchaseOrderRainPlanId")==null){
|
|
|
|
+ tmstrainLoadingResult.setResultId(resultId);
|
|
|
|
+ tmstrainLoadingResult.setResultWagonNo(wagonNo);
|
|
|
|
+ tmstrainLoadingResult.setSendStationId(DataChange.dataToBigDecimal(map.get("sendStationId")));
|
|
|
|
+ tmstrainLoadingResult.setArrivalStationId(DataChange.dataToBigDecimal(map.get("arrivalStationId")));
|
|
|
|
+ tmstrainLoadingResult.setResultLoadingDate(new Date((Long)map.get("resultLoadingDate")));
|
|
|
|
+ if(map.get("resultRemarks")!=null)
|
|
|
|
+ tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
|
|
+ tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
|
+ return -5;
|
|
|
|
+ }
|
|
|
|
+ //进口矿字段
|
|
|
|
+ if(resultType!=3){
|
|
|
|
+ if(map.get("resultClass")!=null)
|
|
|
|
+ tmstrainLoadingResult.setResultClass(map.get("resultClass").toString());
|
|
|
|
+ if(map.get("resultIsclear")!=null)
|
|
|
|
+ tmstrainLoadingResult.setResultIsclear(map.get("resultIsclear").toString());
|
|
|
|
+ if(map.get("capacityId")!=null)
|
|
|
|
+ tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
|
|
|
|
+ if(map.get("resultBillableTonnage")!=null)
|
|
|
|
+ tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("resultBillableTonnage")));
|
|
|
|
+ }
|
|
|
|
+ //通过采购订单号查询获得采购订单ID、批次ID
|
|
|
|
+ if(map.get("purchaseOrderNo")!=null){
|
|
|
|
+ String purchaseOrderNo = map.get("purchaseOrderNo").toString() ;
|
|
|
|
+ BigDecimal purchaseOrderId = tmstrainLoadingResultMapper.getPurchaseOrderIdByPurOrderNo(purchaseOrderNo);
|
|
|
|
+ BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderNo(purchaseOrderNo);
|
|
|
|
+ if(purchaseOrderId==null || batchId==null){
|
|
|
|
+ return -4;
|
|
|
|
+ }
|
|
|
|
+ tmstrainLoadingResult.setBatchId(batchId);
|
|
|
|
+ tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId);
|
|
|
|
+ }
|
|
|
|
+ //设置其他字段
|
|
|
|
+ tmstrainLoadingResult.setResultId(resultId);
|
|
|
|
+ tmstrainLoadingResult.setResultWagonNo(wagonNo);
|
|
|
|
+ tmstrainLoadingResult.setSendStationId(DataChange.dataToBigDecimal(map.get("sendStationId")));
|
|
|
|
+ tmstrainLoadingResult.setArrivalStationId(DataChange.dataToBigDecimal(map.get("arrivalStationId")));
|
|
|
|
+ tmstrainLoadingResult.setResultLoadingDate(new Date((Long)map.get("resultLoadingDate")));
|
|
|
|
+ if(map.get("resultRemarks")!=null)
|
|
|
|
+ tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
tmstrainLoadingResult.setUpdateTime(new Date());
|
|
tmstrainLoadingResult.setUpdateTime(new Date());
|
|
- return tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
|
|
|
+ //更新
|
|
|
|
+ int count=tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
|
+ //更新完成,发送计量委托
|
|
|
|
+ if(count > 0){
|
|
|
|
+ List<Map<String, Object>> resultIdList = new ArrayList<>();
|
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
|
+ Map<String, Object> map2 = new HashMap<>();
|
|
|
|
+ map1.put("resultId",resultId);
|
|
|
|
+ resultIdList.add(map1);
|
|
|
|
+ map2.put("resultIdList",resultIdList);
|
|
|
|
+ tmstrainMeasureCommissionService.batchSendMeasureCommission(map2);
|
|
|
|
+ }
|
|
|
|
+ return count;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|