|
@@ -112,6 +112,8 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
@Transactional
|
|
|
public int addTmstrainLoadingResult(TmstrainLoadingResult tmstrainLoadingResult) throws Exception{
|
|
|
List<String> wagonNoList = tmstrainLoadingResult.getWagonNoList();
|
|
|
+ if(tmstrainLoadingResult.getUserId()==null)
|
|
|
+ throw new Exception("用户id为空,请先登录再操作!");
|
|
|
if(wagonNoList.size()<=0){
|
|
|
throw new Exception("车皮号异常");
|
|
|
}
|
|
@@ -124,7 +126,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
BigDecimal batchId = tmstrainLoadingResultMapper.getBatchIdByPurOrderId(purchaseOrderId);
|
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
|
|
|
|
- addRegularField(tmstrainLoadingResult);
|
|
|
+ addRegularField(tmstrainLoadingResult,tmstrainLoadingResult.getUserId());
|
|
|
|
|
|
int count = 0;
|
|
|
List<Map<String,Object>> resultIdList=new ArrayList<>();
|
|
@@ -139,32 +141,37 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
count += tmstrainLoadingResultMapper.insertSelective(tmstrainLoadingResult);
|
|
|
|
|
|
count += addTotalResult(maxId);
|
|
|
-
|
|
|
|
|
|
Map<String, Object> temp = new HashMap<>();
|
|
|
temp.put("resultId",maxId);
|
|
|
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;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
return count;
|
|
|
}
|
|
|
|
|
|
|
|
|
* 国产矿新增导入
|
|
|
- * @param list
|
|
|
+ * @param mapValue
|
|
|
* @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<TmstrainLoadingTemp> loadingTemps=new ArrayList<>();
|
|
|
|
|
@@ -211,7 +218,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
result.setSendStationId(sendStationId);
|
|
|
}
|
|
|
|
|
|
- addRegularField(result);
|
|
|
+ addRegularField(result,userId);
|
|
|
|
|
|
result.setResultBillableTonnage(new BigDecimal(calculateWagonWeight(result.getResultWagonNo())));
|
|
|
|
|
@@ -236,7 +243,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
* @param map
|
|
|
* @return
|
|
|
*/
|
|
|
- public int updateDomesticLoadResult(Map<String, Object> map){
|
|
|
+ public int updateDomesticLoadResult(Map<String, Object> map) throws Exception {
|
|
|
|
|
|
List<Integer> resultIdList = (List<Integer>) map.get("resultIdList");
|
|
|
TmstrainLoadingResult tmstrainLoadingResult = new TmstrainLoadingResult();
|
|
@@ -253,10 +260,15 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
tmstrainLoadingResult.setSendUnitId(supplierId);
|
|
|
}
|
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId);
|
|
|
+ if(map.get("userId")!=null)
|
|
|
+ tmstrainLoadingResult.setUpdateUsername(map.get("userId").toString());
|
|
|
+ else
|
|
|
+ throw new Exception("用户id为空,请先登录!");
|
|
|
int count = 0;
|
|
|
|
|
|
for (Integer resultId : resultIdList) {
|
|
|
tmstrainLoadingResult.setResultId(new BigDecimal(resultId));
|
|
|
+ tmstrainLoadingResult.setUpdateTime(new Date());
|
|
|
count += tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
}
|
|
|
|
|
@@ -326,9 +338,9 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
* 添加常规字段
|
|
|
* @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.setInsertUpdateRemark("无");
|
|
|
tmstrainLoadingResult.setDeleted(new BigDecimal(0));
|
|
@@ -373,7 +385,7 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
if(map.get("resultRemarks")!=null)
|
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
|
tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
- return -5;
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
if(resultType!=3){
|
|
@@ -384,18 +396,23 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
if(map.get("capacityId")!=null)
|
|
|
tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
|
|
|
if(map.get("resultBillableTonnage")!=null)
|
|
|
- tmstrainLoadingResult.setCapacityId(DataChange.dataToBigDecimal(map.get("resultBillableTonnage")));
|
|
|
+ tmstrainLoadingResult.setResultBillableTonnage(DataChange.dataToBigDecimal(map.get("resultBillableTonnage")));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
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){
|
|
|
+ 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;
|
|
|
}
|
|
|
tmstrainLoadingResult.setBatchId(batchId);
|
|
|
tmstrainLoadingResult.setPurchaseOrderRailPlanId(purchaseOrderId);
|
|
|
+ tmstrainLoadingResult.setMaterialId(materialId);
|
|
|
+ tmstrainLoadingResult.setSendUnitId(supplierId);
|
|
|
}
|
|
|
|
|
|
tmstrainLoadingResult.setResultId(resultId);
|
|
@@ -406,19 +423,24 @@ public class TmstrainLoadingResultServiceImpl implements ITmstrainLoadingResultS
|
|
|
if(map.get("resultRemarks")!=null)
|
|
|
tmstrainLoadingResult.setResultRemarks(map.get("resultRemarks").toString());
|
|
|
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;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(count<=0)
|
|
|
+ return -5;
|
|
|
+
|
|
|
+ return tmstrainLoadingResultMapper.updateByPrimaryKeySelective(tmstrainLoadingResult);
|
|
|
}
|
|
|
|
|
|
|