|
@@ -6,6 +6,7 @@ import com.steerinfo.dil.feign.TmstruckFeign;
|
|
import com.steerinfo.dil.mapper.*;
|
|
import com.steerinfo.dil.mapper.*;
|
|
import com.steerinfo.dil.model.OmstruckOrder;
|
|
import com.steerinfo.dil.model.OmstruckOrder;
|
|
import com.steerinfo.dil.model.TmstruckReceiveResult;
|
|
import com.steerinfo.dil.model.TmstruckReceiveResult;
|
|
|
|
+import com.steerinfo.dil.model.TmstruckWeightBatch;
|
|
import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
import com.steerinfo.dil.service.ITmstruckWeightResultService;
|
|
import com.steerinfo.dil.service.ITmstruckWeightResultService;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
import com.steerinfo.dil.util.DataChange;
|
|
@@ -73,6 +74,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
@Autowired
|
|
@Autowired
|
|
SaleLogUtil saleLogUtil;
|
|
SaleLogUtil saleLogUtil;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ TmstruckWeightBatchMapper tmstruckWeightBatchMapper;
|
|
|
|
+
|
|
|
|
|
|
final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18,23,24,19);
|
|
final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18,23,24,19);
|
|
|
|
|
|
@@ -299,154 +303,114 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
|
|
|
Object resultNetWeight = map.get("resultNetWeight");
|
|
Object resultNetWeight = map.get("resultNetWeight");
|
|
Object FLID = map.get("FLID");
|
|
Object FLID = map.get("FLID");
|
|
-
|
|
+ List<Map<String,Object>> weightMapList = new ArrayList<>();
|
|
- if (resultNetWeight != null && !"".equals(resultNetWeight) && FLID != null && !"".equals(FLID)) {
|
|
+ if(resultNetWeight != null && !"".equals(resultNetWeight) && FLID != null && !"".equals(FLID)) {
|
|
- String flId = FLID.toString();
|
|
+
|
|
- map.put("flId",flId);
|
|
+ Object good = map.get("good");
|
|
- BigDecimal orderIdByFLID = omstruckOrderMapper.selectOrderIdByFLID(FLID);
|
|
+
|
|
- BigDecimal saleMaterialId = tmstruckWeightResultMapper.getSaleMaterialId(map);
|
|
+ Object goodNum = map.get("goodNum");
|
|
-
|
|
+
|
|
- Map<String,Object> orderMesBySaleMaterialId = tmstruckWeightResultMapper.getOrderMesBySaleMaterialIdHaveWeight(saleMaterialId);
|
|
+ Object theoryWeight = map.get("theoryWeight");
|
|
- if(orderMesBySaleMaterialId == null) {
|
|
+ String[] goodList = good.toString().split("、");
|
|
-
|
|
+ String[] flIdList = FLID.toString().split("&");
|
|
- Map<String,Object> orderMesByOrderIdByFLID = tmstruckWeightResultMapper.getOrderMesBySaleMaterialId(orderIdByFLID);
|
|
+ String[] goodNumList = goodNum.toString().split("、");
|
|
- if(orderMesByOrderIdByFLID != null) {
|
|
+ String[] theoryWeightList = theoryWeight.toString().split("、");
|
|
- map.putAll(orderMesByOrderIdByFLID);
|
|
+ for(int i = 0 ; i < flIdList.length ; i ++) {
|
|
- map.put("saleMaterialId",saleMaterialId);
|
|
+ Map<String, Object> codeMap = new HashMap<>();
|
|
- }else{
|
|
+ codeMap.putAll(map);
|
|
- throw new Exception("该分录对应的订单没有净重可供填充!");
|
|
+ codeMap.put("FLID",flIdList[i]);
|
|
- }
|
|
+ codeMap.put("good",goodList[i]);
|
|
- }else{
|
|
+ codeMap.put("goodNum",goodNumList[i]);
|
|
- map.putAll(orderMesBySaleMaterialId);
|
|
+ codeMap.put("theoryWeight",theoryWeightList[i]);
|
|
|
|
+ weightMapList.add(codeMap);
|
|
}
|
|
}
|
|
- }else{
|
|
+ if(weightMapList.size() > 1) {
|
|
- Map<String,Object> orderMes = tmstruckWeightResultMapper.getOrderMes(carNo);
|
|
+ weightMapList.get(weightMapList.size() - 1).put("resultNetWeight",0);
|
|
- if (orderMes == null) {
|
|
+ weightMapList.get(weightMapList.size() - 1).put("resultTareWeight",0);
|
|
- throw new Exception("该车无分录ID且无正在运行中的订单,系统无法匹配数据");
|
|
+ weightMapList.get(weightMapList.size() - 1).put("resultCrossWeight",0);
|
|
}
|
|
}
|
|
- map.putAll(orderMes);
|
|
+ map.put("weightMapList",weightMapList);
|
|
- }
|
|
+ addWeightBatchResult(map);
|
|
-
|
|
+ }else{
|
|
-
|
|
+ weightMapList.add(map);
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
|
|
- int orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
|
-
|
|
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
|
- String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
|
- if(map.get("orderNumber") != null) {
|
|
|
|
- tmstruckWeightResult.setInsertUpdateRemark((String)map.get("orderNumber"));
|
|
|
|
}
|
|
}
|
|
- if(resultNetWeight != null && !"".equals(resultNetWeight)) {
|
|
+ for(Map<String,Object> codeMap : weightMapList) {
|
|
- BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
|
|
+
|
|
- if(materialId == null){
|
|
+ BigDecimal saleMaterialId = null;
|
|
- throw new Exception("系统找不到该物资");
|
|
+ if (resultNetWeight != null && !"".equals(resultNetWeight) && codeMap.get("FLID") != null && !"".equals(codeMap.get("FLID"))) {
|
|
- }
|
|
+ String flId = codeMap.get("FLID").toString();
|
|
- map.put("materialId",materialId);
|
|
+ codeMap.put("flId",flId);
|
|
- try {
|
|
+ BigDecimal orderIdByFLID = omstruckOrderMapper.selectOrderIdByFLID(codeMap.get("FLID"));
|
|
- Map<String,Object> weightSaleMes = tmstruckWeightResultMapper.getWeightAndSaleMaterialId(map);
|
|
+ saleMaterialId = tmstruckWeightResultMapper.getSaleMaterialId(codeMap);
|
|
- if(weightSaleMes != null && DataChange.dataToBigDecimal(weightSaleMes.get("materialIdSale")).compareTo(materialId) == 0) {
|
|
+ codeMap.put("saleMaterialId",saleMaterialId);
|
|
- map.putAll(weightSaleMes);
|
|
+
|
|
- tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
+ Map<String,Object> orderMesBySaleMaterialId = tmstruckWeightResultMapper.getOrderMesBySaleMaterialIdHaveWeight(saleMaterialId);
|
|
|
|
+ if(orderMesBySaleMaterialId == null) {
|
|
|
|
+
|
|
|
|
+ Map<String,Object> orderMesByOrderIdByFLID = tmstruckWeightResultMapper.getOrderMesBySaleMaterialId(orderIdByFLID);
|
|
|
|
+ if(orderMesByOrderIdByFLID != null) {
|
|
|
|
+ codeMap.putAll(orderMesByOrderIdByFLID);
|
|
|
|
+ }else{
|
|
|
|
+ throw new Exception("该分录对应的订单没有净重可供填充!");
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ codeMap.putAll(orderMesBySaleMaterialId);
|
|
}
|
|
}
|
|
- } catch (Exception e) {
|
|
+ }else{
|
|
- e.printStackTrace();
|
|
+ Map<String,Object> orderMes = tmstruckWeightResultMapper.getOrderMes(carNo);
|
|
- }
|
|
+ if (orderMes == null) {
|
|
-
|
|
+ throw new Exception("该车无分录ID且无正在运行中的订单,系统无法匹配数据");
|
|
-
|
|
+ }
|
|
-
|
|
+ codeMap.putAll(orderMes);
|
|
-
|
|
|
|
-
|
|
|
|
- tmstruckWeightResult.setMaterialId(materialId);
|
|
|
|
- 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"));
|
|
|
|
-
|
|
|
|
- Map<String, Object> saleMaterialMes = tmstruckWeightResultMapper.getSaleOrderMaterialNum(map);
|
|
|
|
- if(saleMaterialMes == null) {
|
|
|
|
- throw new Exception("该订单没有该物资分录");
|
|
|
|
- }
|
|
|
|
- BigDecimal saleMaterialId = DataChange.dataToBigDecimal(saleMaterialMes.get("saleMaterialId"));
|
|
|
|
- BigDecimal orderMaterialId = DataChange.dataToBigDecimal(saleMaterialMes.get("orderMaterialId"));
|
|
|
|
- BigDecimal materialWeight = DataChange.dataToBigDecimal(saleMaterialMes.get("materialWeight"));
|
|
|
|
- tmstruckWeightResult.setSaleMaterialId(saleMaterialId);
|
|
|
|
- map.put("orderMaterialId",orderMaterialId);
|
|
|
|
- map.put("saleMaterialId",saleMaterialId);
|
|
|
|
- BigDecimal newWeight = null;
|
|
|
|
- if (materialWeight.intValue() != 0) {
|
|
|
|
- BigDecimal orderMaterialNumber = DataChange.dataToBigDecimal(saleMaterialMes.get("orderMaterialNumber"));
|
|
|
|
- BigDecimal theoreticalWeight = materialWeight.multiply(materialNum);
|
|
|
|
- newWeight = theoreticalWeight.divide(orderMaterialNumber,3,4);
|
|
|
|
- map.put("newWeight",newWeight);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
- if(map.get("theoryWeight") != null && !"".equals(map.get("theoryWeight"))) {
|
|
+ tmstruckWeightResult.setId(DataChange.dataToBigDecimal(codeMap.get("weightTaskResultId")));
|
|
- newWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
+ int orderType = DataChange.dataToBigDecimal(codeMap.get("orderTypee")).intValue();
|
|
- map.put("newWeight",newWeight);
|
|
+
|
|
|
|
+ tmstruckWeightResult.setResultPoundNo((String) codeMap.get("resultPoundNo"));
|
|
|
|
+ String resultCrossWeightTime = (String) codeMap.get("resultCrossWeightTime");
|
|
|
|
+ if(codeMap.get("orderNumber") != null) {
|
|
|
|
+ tmstruckWeightResult.setInsertUpdateRemark((String)codeMap.get("orderNumber"));
|
|
}
|
|
}
|
|
- tmstruckWeightResultMapper.updateOrderMaterial(map);
|
|
+ if(resultNetWeight != null && !"".equals(resultNetWeight) && codeMap.get("saleMaterialId") != null) {
|
|
- tmstruckWeightResultMapper.updateSaleMaterialId(saleMaterialId,materialNum,newWeight);
|
|
+ codeMap.put("good",codeMap.get("goodspa") + "" + codeMap.get("good"));
|
|
-
|
|
+ BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(codeMap);
|
|
- tmstruckWeightResultMapper.updateQuitSaleMaterialId(map);
|
|
+ if(materialId == null){
|
|
- }else{
|
|
+ throw new Exception("系统找不到该物资");
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- List<BigDecimal> weightSaleMaterialIds = tmstruckWeightResultMapper.getWeightTaskIdCopy(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
|
- if(weightSaleMaterialIds.size() == 0) {
|
|
|
|
-
|
|
|
|
- BigDecimal saleMaterialIds = tmstruckWeightResultMapper.getMaterialIdByOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
|
- if(saleMaterialIds != null) {
|
|
|
|
- tmstruckWeightResult.setSaleMaterialId(saleMaterialIds);
|
|
|
|
}
|
|
}
|
|
|
|
+ codeMap.put("materialId",materialId);
|
|
|
|
+ tmstruckWeightResult.setMaterialId(materialId);
|
|
|
|
+ tmstruckWeightResult.setMaterialNum(DataChange.dataToBigDecimal(codeMap.get("goodNum")));
|
|
|
|
+ tmstruckWeightResult.setSaleMaterialId(DataChange.dataToBigDecimal(codeMap.get("saleMaterialId")));
|
|
|
|
+ tmstruckWeightResult.setSaleMaterialId(saleMaterialId);
|
|
}
|
|
}
|
|
- }
|
|
+ addWeightResult(tmstruckWeightResult, codeMap);
|
|
- addWeightResult(tmstruckWeightResult, map);
|
|
+
|
|
-
|
|
+ if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
- if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
+ codeMap.put("segmentSqe", codeMap.get("tareSegmentSqe"));
|
|
- map.put("segmentSqe", map.get("tareSegmentSqe"));
|
|
|
|
- }else{
|
|
|
|
-
|
|
|
|
- BigDecimal orderLineSqe = tmstruckWeightResultMapper.selectOrderLineSqe(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
|
- if(orderLineSqe != null && orderLineSqe.compareTo(DataChange.dataToBigDecimal(map.get("grossSegmentSqe"))) > 0){
|
|
|
|
- map.put("segmentSqe",orderLineSqe);
|
|
|
|
}else{
|
|
}else{
|
|
- map.put("segmentSqe", map.get("grossSegmentSqe"));
|
|
+
|
|
|
|
+ BigDecimal orderLineSqe = tmstruckWeightResultMapper.selectOrderLineSqe(DataChange.dataToBigDecimal(codeMap.get("resultTotalId")));
|
|
|
|
+ if(orderLineSqe != null && orderLineSqe.compareTo(DataChange.dataToBigDecimal(codeMap.get("grossSegmentSqe"))) > 0){
|
|
|
|
+ codeMap.put("segmentSqe",orderLineSqe);
|
|
|
|
+ }else{
|
|
|
|
+ codeMap.put("segmentSqe", codeMap.get("grossSegmentSqe"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
+ if(orderType == 1 || orderType == 4){
|
|
- if(orderType == 1 || orderType == 4){
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+ List<Map<String, Object>> steelMapList = tmstruckWeightResultMapper.getNoNetWeightResultId(DataChange.dataToBigDecimal(codeMap.get("resultTotalId")));
|
|
- List<Map<String, Object>> steelMapList = tmstruckWeightResultMapper.getNoNetWeightResultId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
+ if(steelMapList.size() >= 2){
|
|
- if(steelMapList.size() >= 2){
|
|
+ Map<String, Object> steelMap = steelMapList.get(1);
|
|
- Map<String, Object> steelMap = steelMapList.get(1);
|
|
+ if(resultNetWeight != null && !"".equals(resultNetWeight)){
|
|
- if(resultNetWeight != null && !"".equals(resultNetWeight)){
|
|
+ updateSteelAssemble(codeMap, steelMap);
|
|
- updateSteelAssemble(map, steelMap);
|
|
+ codeMap.put("segmentSqe", steelMap.get("tareSegmentSqe"));
|
|
- map.put("segmentSqe", steelMap.get("tareSegmentSqe"));
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ utilsService.updateOrderLineSequence(codeMap);
|
|
}
|
|
}
|
|
- utilsService.updateOrderLineSequence(map);
|
|
+
|
|
return tmstruckWeightResult;
|
|
return tmstruckWeightResult;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -915,6 +879,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
if(map.get("good") != null && !"".equals(map.get("good"))){
|
|
if(map.get("good") != null && !"".equals(map.get("good"))){
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
+ map.put("good",map.get("goodspa") + "" + map.get("good"));
|
|
BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
|
|
BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
|
|
if(materialId == null) {
|
|
if(materialId == null) {
|
|
return "没有找到该物资,返回failed";
|
|
return "没有找到该物资,返回failed";
|
|
@@ -1050,7 +1015,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
if(weightTaskResultId != null && saleMaterialId != null) {
|
|
if(weightTaskResultId != null && saleMaterialId != null) {
|
|
|
|
|
|
System.out.println("更新计量实绩校验");
|
|
System.out.println("更新计量实绩校验");
|
|
- tmstruckWeightResultMapper.updateWeightTaskBySaleMaterialId(weightTaskResultId,saleMaterialId);
|
|
+
|
|
}
|
|
}
|
|
if (j == 0) {
|
|
if (j == 0) {
|
|
|
|
|
|
@@ -1242,4 +1207,53 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
return mapList;
|
|
return mapList;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public void addWeightBatchResult(Map<String,Object> map) {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ TmstruckWeightBatch tmstruckWeightBatch = new TmstruckWeightBatch();
|
|
|
|
+ BigDecimal weightBatchId = tmstruckWeightBatchMapper.weightBatchID();
|
|
|
|
+ tmstruckWeightBatch.setId(weightBatchId);
|
|
|
|
+
|
|
|
|
+ if(map.get("resultTareWeight") != null && !"".equals(map.get("resultTareWeight"))) {
|
|
|
|
+ tmstruckWeightBatch.setBatchTareWeight(DataChange.dataToBigDecimal(map.get("resultTareWeight")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(map.get("resultCrossWeight") != null && !"".equals(map.get("resultCrossWeight"))) {
|
|
|
|
+ tmstruckWeightBatch.setBatchGrossWeight(DataChange.dataToBigDecimal(map.get("resultCrossWeight")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(map.get("resultNetWeight") != null && !"".equals(map.get("resultNetWeight"))) {
|
|
|
|
+ tmstruckWeightBatch.setBatchNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(map.get("resultCrossWeightTime") != null && !"".equals(map.get("resultCrossWeightTime"))) {
|
|
|
|
+ try {
|
|
|
|
+ tmstruckWeightBatch.setBatchGrossWeightTime(sdf.parse(map.get("resultCrossWeightTime").toString()));
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(map.get("resultTareWeightTime") != null && !"".equals(map.get("resultTareWeightTime"))) {
|
|
|
|
+ try {
|
|
|
|
+ tmstruckWeightBatch.setBatchTareWeightTime(sdf.parse(map.get("resultTareWeightTime").toString()));
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<Map<String,Object>> weightMapList = (List<Map<String, Object>>) map.get("weightMapList");
|
|
|
|
+
|
|
|
|
+ for (Map<String,Object> weightMap : weightMapList) {
|
|
|
|
+ weightMap.put("weightBatchId",weightBatchId);
|
|
|
|
+ tmstruckWeightBatchMapper.updateFluMes(weightMap);
|
|
|
|
+ }
|
|
|
|
+ for (Map<String,Object> weightMap : weightMapList) {
|
|
|
|
+ weightMap.put("weightBatchId",weightBatchId);
|
|
|
|
+ tmstruckWeightBatchMapper.updateOmMes(weightMap);
|
|
|
|
+ }
|
|
|
|
+ tmstruckWeightBatchMapper.insertSelective(tmstruckWeightBatch);
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|