|
@@ -1,6 +1,8 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
import com.steerinfo.dil.feign.BmsTruckFeign;
|
|
|
+import com.steerinfo.dil.feign.OmsFeign;
|
|
|
+import com.steerinfo.dil.feign.TmstruckFeign;
|
|
|
import com.steerinfo.dil.mapper.TmstrainWeightResultMapper;
|
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
|
import com.steerinfo.dil.mapper.UtilsMapper;
|
|
@@ -47,6 +49,12 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
@Autowired
|
|
|
UtilsMapper utilsMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ OmsFeign omsFeign;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TmstruckFeign tmstruckFeign;
|
|
|
+
|
|
|
@Autowired
|
|
|
TmstruckReceiptResultMapper tmstruckReceiptResultMapper;
|
|
|
|
|
@@ -55,7 +63,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
|
|
|
|
|
|
//属于采购订单的订单类型(先计毛后计皮)
|
|
|
- final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 14,15, 17, 18);
|
|
|
+ final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18);
|
|
|
|
|
|
//老厂区需要给金蝶回传的数据订单类型
|
|
|
// final private List<Integer> judgeToKDTypeList = Arrays.asList(6, 17);
|
|
@@ -124,7 +132,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
if(oneMap == null){
|
|
|
return map.get("orderNumber") + "系统无此订单";
|
|
|
}
|
|
|
- Integer orderType= DataChange.dataToBigDecimal(oneMap.get("orderType")).intValue();
|
|
|
+ int orderType= DataChange.dataToBigDecimal(oneMap.get("orderType")).intValue();
|
|
|
if(orderType == 11){
|
|
|
return insertWeightResultBy11(map, oneMap);
|
|
|
}
|
|
@@ -158,8 +166,12 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
}
|
|
|
}
|
|
|
tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
+ //如果订单类型是零星订单 需要查询一下是否还有未计量物资
|
|
|
+ if(orderType == 12 || orderType == 13){
|
|
|
+ dealWithLxOrder(map, stringObjectMap);
|
|
|
+ }
|
|
|
//推送数据
|
|
|
- utilsService.pushMesToWebsocket((String) stringObjectMap.get("capacityNumber"), "计量");
|
|
|
+ utilsService.pushMesToWebsocket((String) oneMap.get("capacityNumber"), "计量");
|
|
|
return map.get("orderNumber") + "成功";
|
|
|
}
|
|
|
|
|
@@ -173,7 +185,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
public TmstruckWeightResult generateWeightResult(Map<String, Object> map) throws Exception {
|
|
|
TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
|
- Integer orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
+ int orderType = DataChange.dataToBigDecimal(map.get("orderTypee")).intValue();
|
|
|
//磅单号
|
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
@@ -200,7 +212,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else if(orderType == 10 || orderType == 20){
|
|
|
+ else if(orderType == 10 || orderType == 20 || orderType == 14){
|
|
|
//查询还有几条没有净重的实绩
|
|
|
Integer resultNum = tmstruckWeightResultMapper.selectNoNetWeightResult((String) map.get("orderNumber"));
|
|
|
if(resultNum == 2){
|
|
@@ -247,6 +259,19 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
}else{
|
|
|
map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
}
|
|
|
+ if(orderType == 1){
|
|
|
+ //如果是钢材订单,获取下一个还没计量的实绩 将毛重数据作为下一个计量实绩的皮重
|
|
|
+ //并且是第二次传入重量才执行
|
|
|
+ List<Map<String, Object>> steelMapList = tmstruckWeightResultMapper.getNoNetWeightResultId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
+ if(steelMapList.size() >= 2){ //当前更新还未提交所以如果是拼装需要查询两个出来 以第二个为准
|
|
|
+ Map<String, Object> steelMap = steelMapList.get(1);
|
|
|
+ Object resultNetWeight = map.get("resultNetWeight");
|
|
|
+ if(resultNetWeight != null && !"".equals(resultNetWeight)){
|
|
|
+ updateSteelAssemble(map, steelMap); //更新下一拼实绩
|
|
|
+ map.put("segmentSqe", steelMap.get("tareSegmentSqe")); // 修改路段顺序号直接到下一皮重路段顺序
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
utilsService.updateOrderLineSequence(map);
|
|
|
}
|
|
|
return tmstruckWeightResult;
|
|
@@ -382,12 +407,27 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
tmstruckWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
|
|
|
- Integer sqe = DataChange.dataToBigDecimal(oneMap.get("Sqe")).intValue(); //获取订单路段顺序号
|
|
|
+ int sqe = DataChange.dataToBigDecimal(oneMap.get("Sqe")).intValue(); //获取订单路段顺序号
|
|
|
sqe = sqe + 1;
|
|
|
- Map<String, Object> threeMap = new HashMap<>(); //用于更新路段顺序号
|
|
|
- threeMap.put("orderLineSequence", sqe);
|
|
|
- threeMap.put("orderNumber", map.get("orderNumber"));
|
|
|
- utilsMapper.updateLineSeqByOrderIdOrNum2(threeMap); //更新订单路段顺序号
|
|
|
+ Object resultNetWeight = map.get("resultNetWeight");
|
|
|
+ if(resultNetWeight != null && !"".equals((String) resultNetWeight)){
|
|
|
+ //判断是否有卸货实绩已经卸过货 如果有卸货实绩 则结束订单
|
|
|
+ Integer resultId = utilsMapper.getUnloadResultByTotalId(DataChange.dataToBigDecimal(oneMap.get("totalId")));
|
|
|
+ if(resultId != null){
|
|
|
+ int orderIds = DataChange.dataToBigDecimal(oneMap.get("orderIds")).intValue();
|
|
|
+ omsFeign.closeInwardOrder(orderIds, sqe, (String) resultNetWeight);
|
|
|
+ }else {
|
|
|
+ Map<String, Object> threeMap = new HashMap<>(); //用于更新路段顺序号
|
|
|
+ threeMap.put("orderLineSequence", sqe);
|
|
|
+ threeMap.put("orderNumber", map.get("orderNumber"));
|
|
|
+ utilsMapper.updateLineSeqByOrderIdOrNum2(threeMap); //更新订单路段顺序号
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ Map<String, Object> threeMap = new HashMap<>(); //用于更新路段顺序号
|
|
|
+ threeMap.put("orderLineSequence", sqe);
|
|
|
+ threeMap.put("orderNumber", map.get("orderNumber"));
|
|
|
+ utilsMapper.updateLineSeqByOrderIdOrNum2(threeMap); //更新订单路段顺序号
|
|
|
+ }
|
|
|
//首先查询这个订单号的这个物资ID是否有计量实绩
|
|
|
Map<String, Object> twoMap = tmstruckWeightResultMapper.selectResultIdByOrderNoAndMaterialId(map); //判断这个物资是否已经计量过
|
|
|
Object resultCrossWeightTime = map.get("resultCrossWeightTime");
|
|
@@ -429,6 +469,65 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return map.get("orderNumber") + "成功";
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理零星订单多拼方法
|
|
|
+ * @Author TXF
|
|
|
+ * @Date 2022/3/15 18:37
|
|
|
+ * @param map
|
|
|
+ * @param stringObjectMap
|
|
|
+ * @return
|
|
|
+ **/
|
|
|
+ public void dealWithLxOrder(Map<String, Object> map, Map<String, Object> stringObjectMap){
|
|
|
+ if(map.get("resultNetWeight") != null){
|
|
|
+ String resultNetWeight = String.valueOf(map.get("resultNetWeight"));
|
|
|
+ if(! ("".equals(resultNetWeight) || "null".equals(resultNetWeight))){
|
|
|
+ //查询是否还有物资如果为空则为已经计量完成
|
|
|
+ Integer materialId = utilsMapper.getNextMaterialId(DataChange.dataToBigDecimal(stringObjectMap.get("orderId")));
|
|
|
+ if(materialId != null){
|
|
|
+ stringObjectMap.put("materialId", materialId);
|
|
|
+ stringObjectMap.put("asd", 1);
|
|
|
+ Map<String, Object> returnMap = null;
|
|
|
+ try {
|
|
|
+ returnMap = tmstruckFeign.sendMeasureCommission(stringObjectMap);
|
|
|
+ String code = (String) returnMap.get("code");
|
|
|
+ if(!"200".equals(code)){
|
|
|
+ System.out.println(returnMap.get("data"));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改拼装钢材物资
|
|
|
+ * @param map
|
|
|
+ * @param steelMap
|
|
|
+ */
|
|
|
+ public void updateSteelAssemble(Map<String, Object> map, Map<String, Object> steelMap) throws Exception{
|
|
|
+ //更新实绩
|
|
|
+ TmstruckWeightResult steelWightModel = new TmstruckWeightResult();
|
|
|
+ steelWightModel.setId(DataChange.dataToBigDecimal(steelMap.get("weightTaskResultId"))); //查询出来的主键
|
|
|
+ steelMap.put("resultTareCalculateNumber", map.get("resultCrossCalculateNumber")); //皮重汽车衡即为毛重汽车衡
|
|
|
+ steelMap.put("resultTareWeight", map.get("resultCrossWeight"));//皮重即为毛重
|
|
|
+ steelMap.put("resultTareWeightTime", map.get("resultCrossWeightTime"));//皮重时间即为毛重时间
|
|
|
+ addWeightResult(steelWightModel, steelMap);
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(steelWightModel);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+/*======================================================================================================================================================================
|
|
|
+============================================================================火运火运火运==================================================================================
|
|
|
+======================================================================================================================================================================*/
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 添加火车计量实绩
|
|
|
* @param map
|
|
@@ -529,6 +628,10 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
* @return
|
|
|
**/
|
|
|
public void sendMesToKD(Map<String, Object> map, Integer orderType){
|
|
|
+ String resultTareCalculateNumber = String.valueOf(map.get("resultTareCalculateNumber"));
|
|
|
+ if(! resultTareCalculateNumber.contains("精煤")){ //如果不是精煤称的则不回传金蝶 或者没有皮重称
|
|
|
+ return;
|
|
|
+ }
|
|
|
String orderNumber = (String) map.get("orderNumber");
|
|
|
Map<String, Object> mesMap = new HashMap<>();
|
|
|
switch (orderType){
|
|
@@ -545,4 +648,18 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
KDWebServiceServiceImpl.sendMesToKD(map);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计量联动删除方法
|
|
|
+ * @param mapList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String linkageDeleteTransportOrder(List<Map<String, Object>> mapList) {
|
|
|
+ //联动删除
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ String orderNumber = (String) map.get("orderNumber");
|
|
|
+ tmstruckWeightResultMapper.linkageDeleteTransportOrder(orderNumber);
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
}
|