|
@@ -112,6 +112,8 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
@Transactional
|
|
@Transactional
|
|
public int addTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult) throws Exception{
|
|
public int addTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult) throws Exception{
|
|
List<String> wagonNoList = tmstrainLoadingResult.getWagonNoList();
|
|
List<String> wagonNoList = tmstrainLoadingResult.getWagonNoList();
|
|
|
|
+ if(tmstrainLoadingResult.getUserId()==null)
|
|
|
|
+ throw new Exception("用户id为空,请先登录再操作!");
|
|
if(wagonNoList.size()<=0){
|
|
if(wagonNoList.size()<=0){
|
|
throw new Exception("车皮号异常");
|
|
throw new Exception("车皮号异常");
|
|
}
|
|
}
|
|
@@ -124,7 +126,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderId(purchaseOrderId);
|
|
BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderId(purchaseOrderId);
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
//添加常规字段
|
|
//添加常规字段
|
|
- addRegularField(tmstrainLoadingResult);
|
|
|
|
|
|
+ addRegularField(tmstrainLoadingResult,tmstrainLoadingResult.getUserId());
|
|
//准备插入
|
|
//准备插入
|
|
int count = 0;
|
|
int count = 0;
|
|
List<Map<String,Object>> resultIdList=new ArrayList<>();
|
|
List<Map<String,Object>> resultIdList=new ArrayList<>();
|
|
@@ -139,32 +141,37 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
|
|
count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
|
|
//添加火运总实绩
|
|
//添加火运总实绩
|
|
count += addTotalResult(maxId);
|
|
count += addTotalResult(maxId);
|
|
-
|
|
|
|
//计量委托实绩list
|
|
//计量委托实绩list
|
|
Map<String, Object> temp = new HashMap<>();
|
|
Map<String, Object> temp = new HashMap<>();
|
|
temp.put("resultId",maxId);
|
|
temp.put("resultId",maxId);
|
|
resultIdList.add(temp);
|
|
resultIdList.add(temp);
|
|
}
|
|
}
|
|
//新增完成,发送计量委托
|
|
//新增完成,发送计量委托
|
|
- 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;
|
|
|
|
- }
|
|
|
|
|
|
+// 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;
|
|
|
|
+// }
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 国产矿新增导入
|
|
* 国产矿新增导入
|
|
- * @param list
|
|
|
|
|
|
+ * @param mapValue
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public int addDomesticLoadResult(List<Map<String, Object>> list) throws Exception {
|
|
|
|
|
|
+ public int addDomesticLoadResult(Map<String, Object> mapValue) throws Exception {
|
|
|
|
+ List<Map<String, Object>> list= (List<Map<String, Object>>) mapValue.get("list");
|
|
|
|
+ String userId=null;
|
|
|
|
+ if(mapValue.get("userId")!=null)
|
|
|
|
+ userId=mapValue.get("userId").toString();
|
|
|
|
+ else
|
|
|
|
+ throw new Exception("用户id为空,请先登录再操作!");
|
|
//装车临时list
|
|
//装车临时list
|
|
List<TmstrainLoadingTemp> loadingTemps=new ArrayList<>();
|
|
List<TmstrainLoadingTemp> loadingTemps=new ArrayList<>();
|
|
//装车实绩list
|
|
//装车实绩list
|
|
@@ -211,7 +218,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
result.setSendStationId(sendStationId);
|
|
result.setSendStationId(sendStationId);
|
|
}
|
|
}
|
|
//添加常规字段
|
|
//添加常规字段
|
|
- addRegularField(result);
|
|
|
|
|
|
+ addRegularField(result,userId);
|
|
//通过车皮号计算车皮标重
|
|
//通过车皮号计算车皮标重
|
|
result.setResultBillableTonnage(new BigDecimal(calculateWagonWeight(result.getResultWagonNo())));
|
|
result.setResultBillableTonnage(new BigDecimal(calculateWagonWeight(result.getResultWagonNo())));
|
|
//通过到站ID匹配计量衡 如果是老区轨道衡或者是新区轨道衡 则匹配轨道衡
|
|
//通过到站ID匹配计量衡 如果是老区轨道衡或者是新区轨道衡 则匹配轨道衡
|
|
@@ -236,7 +243,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
* @param map
|
|
* @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public int updateDomesticLoadResult(Map<String, Object> map){
|
|
|
|
|
|
+ public int updateDomesticLoadResult(Map<String, Object> map) throws Exception {
|
|
//获取要补录的实绩ID 列表
|
|
//获取要补录的实绩ID 列表
|
|
List<Integer> resultIdList = (List<Integer>) map.get("resultIdList");
|
|
List<Integer> resultIdList = (List<Integer>) map.get("resultIdList");
|
|
TmstrainLoadingResult tmstrainLoadingResult = new TmstrainLoadingResult();
|
|
TmstrainLoadingResult tmstrainLoadingResult = new TmstrainLoadingResult();
|
|
@@ -253,10 +260,15 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
tmstrainLoadingResult.setSendUnitId(supplierId);
|
|
tmstrainLoadingResult.setSendUnitId(supplierId);
|
|
}
|
|
}
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId); //采购订单Id
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId); //采购订单Id
|
|
|
|
+ if(map.get("userId")!=null)
|
|
|
|
+ tmstrainLoadingResult.setUpdateUsername(map.get("userId").toString());
|
|
|
|
+ else
|
|
|
|
+ throw new Exception("用户id为空,请先登录!");
|
|
int count = 0;
|
|
int count = 0;
|
|
//对每一个实绩id对应的记录修改字段
|
|
//对每一个实绩id对应的记录修改字段
|
|
for (Integer resultId : resultIdList) {
|
|
for (Integer resultId : resultIdList) {
|
|
tmstrainLoadingResult.setResultId(new BigDecimal(resultId)); //设置要补录的实绩主键
|
|
tmstrainLoadingResult.setResultId(new BigDecimal(resultId)); //设置要补录的实绩主键
|
|
|
|
+ tmstrainLoadingResult.setUpdateTime(new Date());
|
|
count += tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
count += tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
}
|
|
}
|
|
//配单成功,发送计量委托
|
|
//配单成功,发送计量委托
|
|
@@ -326,9 +338,9 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
* 添加常规字段
|
|
* 添加常规字段
|
|
* @param tmstrainLoadingResult
|
|
* @param tmstrainLoadingResult
|
|
*/
|
|
*/
|
|
- public void addRegularField(TmstrainLoadingResult tmstrainLoadingResult){
|
|
|
|
|
|
+ public void addRegularField(TmstrainLoadingResult tmstrainLoadingResult,String userName){
|
|
//常规字段插入
|
|
//常规字段插入
|
|
- tmstrainLoadingResult.setInsertUsername("admin");
|
|
|
|
|
|
+ tmstrainLoadingResult.setInsertUsername(userName);
|
|
tmstrainLoadingResult.setInsertTime(new Date());
|
|
tmstrainLoadingResult.setInsertTime(new Date());
|
|
tmstrainLoadingResult.setInsertUpdateRemark("无");
|
|
tmstrainLoadingResult.setInsertUpdateRemark("无");
|
|
tmstrainLoadingResult.setDeleted(new BigDecimal(0));
|
|
tmstrainLoadingResult.setDeleted(new BigDecimal(0));
|
|
@@ -373,7 +385,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
if(map.get("resultRemarks")!=null)
|
|
if(map.get("resultRemarks")!=null)
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
- return -5;
|
|
|
|
|
|
+ return 1;
|
|
}
|
|
}
|
|
//进口矿字段
|
|
//进口矿字段
|
|
if(resultType!=3){
|
|
if(resultType!=3){
|
|
@@ -384,18 +396,23 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
if(map.get("capacityId")!=null)
|
|
if(map.get("capacityId")!=null)
|
|
tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
|
|
tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
|
|
if(map.get("resultBillableTonnage")!=null)
|
|
if(map.get("resultBillableTonnage")!=null)
|
|
- tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("resultBillableTonnage")));
|
|
|
|
|
|
+ tmstrainLoadingResult.setResultBillableTonnage(DataChange.dataToBigDecimal(map.get("resultBillableTonnage")));
|
|
}
|
|
}
|
|
- //通过采购订单号查询获得采购订单ID、批次ID
|
|
|
|
|
|
+ //通过采购订单号查询获得采购订单ID、批次ID、物资ID、发货单位ID
|
|
if(map.get("purchaseOrderNo")!=null){
|
|
if(map.get("purchaseOrderNo")!=null){
|
|
String purchaseOrderNo = map.get("purchaseOrderNo").toString() ;
|
|
String purchaseOrderNo = map.get("purchaseOrderNo").toString() ;
|
|
BigDecimal purchaseOrderId = tmstrainLoadingResultMapper.getPurchaseOrderIdByPurOrderNo(purchaseOrderNo);
|
|
BigDecimal purchaseOrderId = tmstrainLoadingResultMapper.getPurchaseOrderIdByPurOrderNo(purchaseOrderNo);
|
|
BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderNo(purchaseOrderNo);
|
|
BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderNo(purchaseOrderNo);
|
|
- if(purchaseOrderId==null || batchId==null){
|
|
|
|
|
|
+ Map<String,Object> record=tmstrainLoadingResultMapper.getRecordByPurOrderId(purchaseOrderId);
|
|
|
|
+ BigDecimal materialId=DataChange.dataToBigDecimal(record.get("materialId"));
|
|
|
|
+ BigDecimal supplierId=DataChange.dataToBigDecimal(record.get("supplierId"));
|
|
|
|
+ if(purchaseOrderId==null || batchId==null ||materialId==null ||supplierId==null){
|
|
return -4;
|
|
return -4;
|
|
}
|
|
}
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId);
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId);
|
|
|
|
+ tmstrainLoadingResult.setMaterialId(materialId);
|
|
|
|
+ tmstrainLoadingResult.setSendUnitId(supplierId);
|
|
}
|
|
}
|
|
//设置其他字段
|
|
//设置其他字段
|
|
tmstrainLoadingResult.setResultId(resultId);
|
|
tmstrainLoadingResult.setResultId(resultId);
|
|
@@ -406,19 +423,24 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
if(map.get("resultRemarks")!=null)
|
|
if(map.get("resultRemarks")!=null)
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
tmstrainLoadingResult.setUpdateTime(new Date());
|
|
tmstrainLoadingResult.setUpdateTime(new Date());
|
|
- //更新
|
|
|
|
- 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);
|
|
|
|
|
|
+ if(map.get("userId")!=null){
|
|
|
|
+ tmstrainLoadingResult.setUpdateUsername(map.get("userId").toString());
|
|
|
|
+ }else{
|
|
|
|
+ throw new Exception("没有用户id,请登录再操作!");
|
|
}
|
|
}
|
|
- return count;
|
|
|
|
|
|
+ int 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);
|
|
|
|
+// count = tmstrainMeasureCommissionService.batchSendMeasureCommission(map2);
|
|
|
|
+ if(count<=0)
|
|
|
|
+ return -5;
|
|
|
|
+ //更新
|
|
|
|
+ return tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|