|
@@ -1,12 +1,9 @@
|
|
package com.steerinfo.dil.service.impl;
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
-import com.steerinfo.dil.feign.BmsTruckFeign;
|
|
|
|
import com.steerinfo.dil.feign.OmsFeign;
|
|
import com.steerinfo.dil.feign.OmsFeign;
|
|
import com.steerinfo.dil.feign.TmstruckFeign;
|
|
import com.steerinfo.dil.feign.TmstruckFeign;
|
|
-import com.steerinfo.dil.mapper.TmstrainWeightResultMapper;
|
|
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
import com.steerinfo.dil.mapper.UtilsMapper;
|
|
import com.steerinfo.dil.mapper.UtilsMapper;
|
|
-import com.steerinfo.dil.model.TmstrainWeightResult;
|
|
|
|
import com.steerinfo.dil.model.TmstruckReceiptResult;
|
|
import com.steerinfo.dil.model.TmstruckReceiptResult;
|
|
import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
import com.steerinfo.dil.model.TmstruckWeightResult;
|
|
import com.steerinfo.dil.mapper.TmstruckWeightResultMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckWeightResultMapper;
|
|
@@ -58,9 +55,9 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
@Autowired
|
|
@Autowired
|
|
TmstruckReceiptResultMapper tmstruckReceiptResultMapper;
|
|
TmstruckReceiptResultMapper tmstruckReceiptResultMapper;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- TmstrainWeightResultMapper tmstrainWeightResultMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ TmstrainWeightResultServiceImpl tmstrainWeightResultService;
|
|
|
|
|
|
//属于采购订单的订单类型(先计毛后计皮)
|
|
//属于采购订单的订单类型(先计毛后计皮)
|
|
final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18);
|
|
final private List<Integer> judgeOrderTypeList = Arrays.asList(5, 6, 7, 8, 9, 12, 15, 17, 18);
|
|
@@ -93,10 +90,10 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
String resultTareCalculateNumber = (String) map.get("resultTareCalculateNumber");
|
|
String resultTareCalculateNumber = (String) map.get("resultTareCalculateNumber");
|
|
//如果计量衡名字中含有铁专线 则代表是轨道衡 走轨道衡路线
|
|
//如果计量衡名字中含有铁专线 则代表是轨道衡 走轨道衡路线
|
|
if(resultTareCalculateNumber.contains("铁专线")){
|
|
if(resultTareCalculateNumber.contains("铁专线")){
|
|
- sb.append(addTrainWeightResult(map));
|
|
|
|
|
|
+ sb.append(tmstrainWeightResultService.addTrainWeightResult(map));
|
|
}else {
|
|
}else {
|
|
//走汽车衡
|
|
//走汽车衡
|
|
- map.put("needCheckToKD", "1"); //老厂区专属变量 用于区分新、老厂区 老厂区需要给金蝶传输数据
|
|
|
|
|
|
+ map.put("needCheckToKD", "1"); //老厂区专属变量 用于区分新、老厂区 老厂区部分秤需要给金蝶传输数据
|
|
sb.append(addTruckWeightResult(map));
|
|
sb.append(addTruckWeightResult(map));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -522,104 +519,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
|
|
* @Author TXF
|