|
@@ -1,10 +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.*;
|
|
|
-import com.steerinfo.dil.model.TmstrainWeightResult;
|
|
|
import com.steerinfo.dil.model.TmstruckReceiveResult;
|
|
|
import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
|
import com.steerinfo.dil.service.ITmstruckWeightResultService;
|
|
@@ -55,9 +53,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
@Autowired
|
|
|
TmstruckReceiveResultMapper tmstruckReceiveResultMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
- TmstrainWeightResultMapper tmstrainWeightResultMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ TmstrainWeightResultServiceImpl tmstrainWeightResultService;
|
|
|
|
|
|
//属于采购订单的订单类型(先计毛后计皮)
|
|
|
final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18);
|
|
@@ -90,10 +88,10 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
String resultTareCalculateNumber = (String) map.get("resultTareCalculateNumber");
|
|
|
//如果计量衡名字中含有铁专线 则代表是轨道衡 走轨道衡路线
|
|
|
if(resultTareCalculateNumber.contains("铁专线")){
|
|
|
- sb.append(addTrainWeightResult(map));
|
|
|
+ sb.append(tmstrainWeightResultService.addTrainWeightResult(map));
|
|
|
}else {
|
|
|
//走汽车衡
|
|
|
- map.put("needCheckToKD", "1"); //老厂区专属变量 用于区分新、老厂区 老厂区需要给金蝶传输数据
|
|
|
+ map.put("needCheckToKD", "1"); //老厂区专属变量 用于区分新、老厂区 老厂区部分秤需要给金蝶传输数据
|
|
|
sb.append(addTruckWeightResult(map));
|
|
|
}
|
|
|
}
|
|
@@ -130,9 +128,13 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return map.get("orderNumber") + "系统无此订单";
|
|
|
}
|
|
|
int orderType= DataChange.dataToBigDecimal(oneMap.get("orderType")).intValue();
|
|
|
- if(orderType == 11){
|
|
|
+ if(orderType == 11 || orderType == 15 || orderType == 16){
|
|
|
return insertWeightResultBy11(map, oneMap);
|
|
|
}
|
|
|
+ //为1的时候计量重新更新单据
|
|
|
+ if(DataChange.dataToBigDecimal(map.get("WLReUpdateFlag")).intValue() == 1){
|
|
|
+ return linkUpdateAPO(map, orderType);
|
|
|
+ }
|
|
|
//通过运输订单号查询计量实绩Id
|
|
|
Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectWeightIdByOrderId(map);
|
|
|
if(stringObjectMap == null){
|
|
@@ -520,104 +522,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-/*======================================================================================================================================================================
|
|
|
-============================================================================火运火运火运==================================================================================
|
|
|
-======================================================================================================================================================================*/
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加火车计量实绩
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
- public String addTrainWeightResult(Map<String, Object> map){
|
|
|
- //通过采购订单号和车皮号 查询火运总实绩ID和物资ID
|
|
|
- Map<String, Object> totalIdAndMateMap = tmstrainWeightResultMapper.getResultIdByPurNoAndWagonNo(map);
|
|
|
- if(totalIdAndMateMap == null){
|
|
|
- return "采购订单号"+ map.get("purchaseOrderNo")+"或车皮信息"+ map.get("orderNumber")+"错误";
|
|
|
- }
|
|
|
- if(totalIdAndMateMap.get("resultTotalId") == null){
|
|
|
- return "采购订单号"+ map.get("purchaseOrderNo")+"或车皮信息"+ map.get("orderNumber")+"错误";
|
|
|
- }
|
|
|
- map.putAll(totalIdAndMateMap);
|
|
|
- TmstrainWeightResult tmstrainWeightResult = null;
|
|
|
- try {
|
|
|
- tmstrainWeightResult = generateTrainWeightResult(map);
|
|
|
- } catch (Exception e) {
|
|
|
- return e.getMessage(); //捕获异常信息
|
|
|
- }
|
|
|
- tmstrainWeightResultMapper.insertSelective(tmstrainWeightResult);
|
|
|
- return map.get("orderNumber") + "成功";
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成火运计量实体
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
- public TmstrainWeightResult generateTrainWeightResult(Map<String, Object> map) throws Exception {
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- TmstrainWeightResult tmstrainWeightResult = new TmstrainWeightResult();
|
|
|
- tmstrainWeightResult.setResultId(tmstrainWeightResultMapper.selectMaxId());
|
|
|
- //磅单号
|
|
|
- tmstrainWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
- //添加火运总实绩ID
|
|
|
- tmstrainWeightResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
- //设置物资ID
|
|
|
- tmstrainWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
|
|
|
- //如果没有计毛时间 则是第一次计量
|
|
|
- String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
- if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
- //设置毛重时间
|
|
|
- String firstTime = (String) map.get("resultTareWeightTime");
|
|
|
- tmstrainWeightResult.setResultGrossWeightTime(sdf.parse(firstTime));
|
|
|
- //添加毛重轨道衡
|
|
|
- Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
- if(tareId == null){
|
|
|
- throw new Exception("没有此计量衡:" + map.get("resultTareCalculateNumber"));
|
|
|
- }
|
|
|
- tmstrainWeightResult.setResultGrossPlaceId(new BigDecimal(tareId));
|
|
|
- //设置毛重
|
|
|
- BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
- tmstrainWeightResult.setResultGrossWeight(resultTareWeight);
|
|
|
- tmstrainWeightResult.setInsertTime(new Date());
|
|
|
- tmstrainWeightResult.setInsertUsername("admin");
|
|
|
- }else {
|
|
|
- //设置皮重轨道衡
|
|
|
- Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
- if(tareId == null){
|
|
|
- throw new Exception("没有此计量衡:" + map.get("resultTareCalculateNumber"));
|
|
|
- }
|
|
|
- tmstrainWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
- //设置毛重轨道衡
|
|
|
- Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultCrossCalculateNumber"));
|
|
|
- if(crossId == null){
|
|
|
- throw new Exception("没有此计量衡:" + map.get("resultCrossCalculateNumber"));
|
|
|
- }
|
|
|
- tmstrainWeightResult.setResultGrossPlaceId(new BigDecimal(crossId));
|
|
|
- //毛重
|
|
|
- BigDecimal resultCrossWeight = DataChange.dataToBigDecimal(map.get("resultCrossWeight"));
|
|
|
- tmstrainWeightResult.setResultGrossWeight(resultCrossWeight);
|
|
|
- //皮重
|
|
|
- BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
- tmstrainWeightResult.setResultTareWeight(resultTareWeight);
|
|
|
- //净重
|
|
|
- tmstrainWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
- //设置皮重时间
|
|
|
- String resultTareWeightTime = (String) map.get("resultTareWeightTime");
|
|
|
- tmstrainWeightResult.setResultTareWeightTime(sdf.parse(resultTareWeightTime));
|
|
|
- //设置毛重时间
|
|
|
- String resultGrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
- tmstrainWeightResult.setResultGrossWeightTime(sdf.parse(resultGrossWeightTime));
|
|
|
- tmstrainWeightResult.setUpdateTime(new Date());
|
|
|
- tmstrainWeightResult.setUpdateUsername("admin");
|
|
|
- }
|
|
|
- return tmstrainWeightResult;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 回传数据给金蝶方法
|
|
|
* @Author TXF
|
|
@@ -660,4 +564,29 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
}
|
|
|
return "success";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计量联动修改方法(修改关联的采购订单,以及同步修改运输订单物资子表的物资)
|
|
|
+ * @param map
|
|
|
+ * @param orderType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public String linkUpdateAPO(Map<String, Object> map, Integer orderType){
|
|
|
+ //如果等于1 则代表是需要变更采购订单号的订单
|
|
|
+ Map<String, Object> mesMap = tmstruckWeightResultMapper.getAPOMes(String.valueOf(map.get("ArrivalBillNo")));
|
|
|
+ if (mesMap == null){
|
|
|
+ return map.get("ArrivalBillNo") + "系统没有此订单号!失败";
|
|
|
+ }
|
|
|
+ mesMap.put("orderNumber", map.get("orderNumber"));
|
|
|
+ if(orderType == 20){
|
|
|
+ //20订单修改的表不一样呀
|
|
|
+ tmstruckWeightResultMapper.updatePurchaseInwordAPOId(mesMap);
|
|
|
+ tmstruckWeightResultMapper.updateOmsTruckMaterialId(mesMap);
|
|
|
+ }else{
|
|
|
+ //修改订单管理采购订单ID 以及物资子表 物资ID
|
|
|
+ tmstruckWeightResultMapper.updateOmsTruckPlanId(mesMap);
|
|
|
+ tmstruckWeightResultMapper.updateOmsTruckMaterialId(mesMap);
|
|
|
+ }
|
|
|
+ return mesMap.get("orderNumber") + "数据修改成功";
|
|
|
+ }
|
|
|
}
|