|
@@ -175,215 +175,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 更新计毛实绩 采集需要的数据
|
|
|
- * 运输订单号
|
|
|
- * 汽车衡编号
|
|
|
- * 物资ID
|
|
|
- * 毛重
|
|
|
- * 毛重时间
|
|
|
- * 磅单号
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public int addJiMaoResult(Map<String, Object> map) {
|
|
|
- TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
- //通过传来的运输订单号与物资ID查询计重实绩
|
|
|
- map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
|
- generateMaoWeightResult(map, tmstruckWeightResult);
|
|
|
- BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
|
- BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
- int i = 0;
|
|
|
- switch (orderType.intValue()){
|
|
|
- case 1:
|
|
|
- case 4:
|
|
|
- //添加第二次计量常规字段
|
|
|
- addUpdateRegularField(tmstruckWeightResult);
|
|
|
- //查询当前计毛是否为最后一拼(针对多拼) (查询是否还有装车实绩没有数据)
|
|
|
- List<Map<String, Object>> list = rulesMapper.judgeLastMaterial(orderId);
|
|
|
- if(list.size() == 0){
|
|
|
- //如果没有未装车的装车实绩则计算出厂门岗并更新出厂实绩
|
|
|
- BigDecimal resultTotalId = DataChange.dataToBigDecimal(map.get("resultTotalId"));
|
|
|
- //计算出厂门岗 更新出厂门岗
|
|
|
- int gatepostId = rulesService.calculateGatepost(map);
|
|
|
- i += tmstruckLeaveFactoryResultService.updateLeaveFactoryGatepostId(resultTotalId.intValue(), gatepostId);
|
|
|
- }else {
|
|
|
- //如果还有未装车的实绩 则代表还有未装车的物资 计算下一装车物资ID 更新下一物资的计皮实绩
|
|
|
- Map<String, Object> platIdMap = rulesService.calculateMaterial(list); //获得materialId loadingId
|
|
|
- platIdMap.put("orderId", map.get("orderId"));
|
|
|
- //更新下一计量实绩以当前毛重为皮重 以当前汽车衡为下一计量实绩的计皮汽车衡
|
|
|
- platIdMap.put("tarePlaceId", tmstruckWeightResult.getResultTarePlaceId());
|
|
|
- platIdMap.put("resultTareWeight", map.get("resultGrossWeight"));
|
|
|
- i += updateWeightResult(platIdMap);
|
|
|
- //添加仓库排队
|
|
|
-// platIdMap.put("orderNumber", map.get("orderNumber"));
|
|
|
-// qmsFeign.addQueueResultByCk(platIdMap);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- case 3:
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- case 6:
|
|
|
- case 7:
|
|
|
- case 8:
|
|
|
- case 9: //采购订单记录计毛为第一次计重 添加磅单号
|
|
|
- addInsertRegularField(tmstruckWeightResult); //插入第一次计重时间常规字段
|
|
|
- break;
|
|
|
- case 10:
|
|
|
- break;
|
|
|
- case 11:
|
|
|
- break;
|
|
|
- case 12:
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
- i += tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
- //路段顺序号 + 1
|
|
|
- omsFeign.pushMesToWebsocket(map);
|
|
|
- return i;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成计毛实体类
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
- public void generateMaoWeightResult(Map<String, Object> map, TmstruckWeightResult tmstruckWeightResult){
|
|
|
- //添加磅单号
|
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
- //添加查询出来的主键
|
|
|
- BigDecimal weightTaskResultId = DataChange.dataToBigDecimal(map.get("weightTaskResultId"));
|
|
|
- tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
- //添加毛重
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- String resultGrossWeight = df.format(DataChange.dataToBigDecimal(map.get("resultGrossWeight")).doubleValue());
|
|
|
- tmstruckWeightResult.setResultGrossWeight(new BigDecimal(resultGrossWeight));
|
|
|
- //添加毛重时间
|
|
|
- long resultGrossWeightTime = (long) map.get("resultGrossWeightTime");
|
|
|
- tmstruckWeightResult.setResultGrossWeightTime(new Date(resultGrossWeightTime));
|
|
|
- //添加净重 (如果传入的净重不为0)
|
|
|
- BigDecimal resultNetWeight = DataChange.dataToBigDecimal(map.get("resultNetWeight"));
|
|
|
- if(resultNetWeight.intValue() != 0){
|
|
|
- tmstruckWeightResult.setResultNetWeight(resultNetWeight);
|
|
|
- }
|
|
|
- //通过汽车衡编号查询汽车衡ID
|
|
|
- String truckCalculateNumber = (String) map.get("truckCalculateNumber");
|
|
|
- if(truckCalculateNumber != null) {
|
|
|
- Integer calculateId = tmstruckWeightResultMapper.selectTruckCalculateId(truckCalculateNumber);
|
|
|
- //添加计毛汽车衡
|
|
|
- if (calculateId != null) {
|
|
|
- tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(calculateId));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 更新计皮实绩 需要采集的数据
|
|
|
- * 运输订单号 orderNumber
|
|
|
- * 汽车衡编号 truckCalculateNumber
|
|
|
- * 皮重 resultTareWeight
|
|
|
- * 皮重时间 resultTareWeightTime
|
|
|
- * 净重
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- @Transactional
|
|
|
- public int addJiPiResult(Map<String, Object> map) {
|
|
|
- TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
- //通过传来的运输订单号 与 物资ID查询计重实绩ID
|
|
|
- map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
|
- generatePiWeightResult(map, tmstruckWeightResult);
|
|
|
- int i = 0;
|
|
|
- BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
- switch (orderType.intValue()){
|
|
|
- case 1:
|
|
|
- case 4:
|
|
|
- //销售订单计皮为第一次计重
|
|
|
- addInsertRegularField(tmstruckWeightResult);// 添加插入常规字段 就是第一次计重时间;
|
|
|
- //查询还未装车的物资
|
|
|
- List<Map<String, Object>> mapList = rulesService.judgeLastMaterial(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
- if(mapList.size() == 1){
|
|
|
- //如果是单拼 则直接
|
|
|
- Map<String, Object> mesMap = mapList.get(0);
|
|
|
- i += tmstruckLoadResultService.updateLoadingId(mesMap); //更新装货点
|
|
|
- //添加仓库排队
|
|
|
- mesMap.put("orderNumber", map.get("orderNumber"));
|
|
|
-// qmsFeign.addQueueResultByCk(mesMap);
|
|
|
- }else {
|
|
|
- //如果是多拼 使用多种物资计算第一个装货的物资和装车点
|
|
|
- Map<String, Object> platIdMap = rulesService.calculateMaterial(mapList); //获得materialId loadingId
|
|
|
- platIdMap.put("orderId", map.get("orderId"));
|
|
|
- i += tmstruckLoadResultService.updateLoadingId(platIdMap); //更新装货点
|
|
|
- //添加仓库排队
|
|
|
- platIdMap.put("orderNumber", map.get("orderNumber"));
|
|
|
-// qmsFeign.addQueueResultByCk(platIdMap);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- case 3:
|
|
|
- //销售订单计皮为第一次计重
|
|
|
- addInsertRegularField(tmstruckWeightResult);// 添加插入常规字段 就是第一次计重时间;
|
|
|
- //焦炭、水渣只有一种物资 装货点是通过发运计划的时候填写的
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- case 6:
|
|
|
- case 7:
|
|
|
- case 8:
|
|
|
- case 9:
|
|
|
- //如果订单类型为采购订单 则执行采购订单计皮规则
|
|
|
- addUpdateRegularField(tmstruckWeightResult); // 添加更新常规字段 就是第二次计重时间
|
|
|
- //计皮作业完成后自动完成签收
|
|
|
- i += autoReceipt(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
- //计皮完成后计算出厂门岗并更新实绩出厂门岗ID
|
|
|
- i += rulesService.calculateGatepost(map);
|
|
|
- break;
|
|
|
- case 10:
|
|
|
- break;
|
|
|
- case 11:
|
|
|
- break;
|
|
|
- }
|
|
|
- i += tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
- //路段顺序号 + 1
|
|
|
- i += utilsService.updateOrderLineSequence(map);
|
|
|
- return i;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成计皮实绩
|
|
|
- * @param tmstruckWeightResult
|
|
|
- * @return
|
|
|
- */
|
|
|
- public void generatePiWeightResult(Map<String, Object> map, TmstruckWeightResult tmstruckWeightResult){
|
|
|
- //添加磅单号
|
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
- //添加查询出来的主键
|
|
|
- BigDecimal resultId = (BigDecimal) map.get("weightTaskResultId");
|
|
|
- tmstruckWeightResult.setWeightTaskResultId(resultId);
|
|
|
- //添加皮重
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- String resultTareWeight = df.format((double) map.get("resultTareWeight"));
|
|
|
- tmstruckWeightResult.setResultTareWeight(new BigDecimal(resultTareWeight));
|
|
|
- //添加皮重时间
|
|
|
- long resultTareWeightTime = (long) map.get("resultTareWeightTime");
|
|
|
- tmstruckWeightResult.setResultTareWeightTime(new Date(resultTareWeightTime));
|
|
|
- //添加净重 (如果传入的净重不为0)
|
|
|
- BigDecimal resultNetWeight = DataChange.dataToBigDecimal(map.get("resultNetWeight"));
|
|
|
- if(resultNetWeight.intValue() != 0){
|
|
|
- tmstruckWeightResult.setResultNetWeight(resultNetWeight);
|
|
|
- }
|
|
|
- //通过汽车衡编号查询汽车衡ID 添加计皮汽车衡
|
|
|
- Integer calculateId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("truckCalculateNumber"));
|
|
|
- if(calculateId != null){
|
|
|
- tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(calculateId));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 更新计量实绩 计皮点 计毛点 皮重
|
|
|
* @param map
|
|
@@ -396,7 +187,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
if(map.get("tarePlaceId") != null){ //如果皮重汽车衡不为空 更新皮重汽车衡
|
|
|
tmstruckWeightResult.setResultTarePlaceId(DataChange.dataToBigDecimal(map.get("tarePlaceId")));
|
|
|
}
|
|
|
- if(map.get("grossPlaceId") != null){//如果毛重汽车衡不为空 更新毛重汽车衡
|
|
|
+ if(map.get("grossPlaceId") != null){//如果毛重汽车衡不为空 更新毛重汽车衡
|
|
|
tmstruckWeightResult.setResultGrossPlaceId(DataChange.dataToBigDecimal(map.get("grossPlaceId")));
|
|
|
}
|
|
|
if(map.get("resultTareWeight")!= null){ //如果皮重不为空 更新皮重
|
|
@@ -418,24 +209,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return tmstruckReceiptResultMapper.updateByTotalResultId(tmstruckReceiptResult);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 添加首次计重时的常规字段
|
|
|
- * @param tmstruckWeightResult
|
|
|
- */
|
|
|
- public void addInsertRegularField(TmstruckWeightResult tmstruckWeightResult){
|
|
|
- tmstruckWeightResult.setInsertTime(new Date());
|
|
|
- tmstruckWeightResult.setInsertUsername("admin");
|
|
|
- tmstruckWeightResult.setInsertUpdateRemark("无");
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加第二次计重时的常规字段
|
|
|
- * @param tmstruckWeightResult
|
|
|
- */
|
|
|
- public void addUpdateRegularField(TmstruckWeightResult tmstruckWeightResult){
|
|
|
- tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
- tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 多拼计算计毛汽车衡
|
|
@@ -490,90 +263,4 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return updateWeightResult(oIdAndMidMap);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 添加计量实绩
|
|
|
- * 传参样式:
|
|
|
- * {
|
|
|
- "orderNumber":"WYSDD2021091000000002",
|
|
|
- "resultTareCalculateNumber":"1号汽车衡",
|
|
|
- "resultCrossCalculateNumber":"1号汽车衡",
|
|
|
- "resultTareWeight":40.00,
|
|
|
- "resultCrossWeight":40.00,
|
|
|
- "resultNetWeight":0,
|
|
|
- "resultTareWeightTime":"2021-09-10 09:05:22",
|
|
|
- "resultCrossWeightTime":"2021-09-10 09:05:22",
|
|
|
- "resultNetWeightTime":"2021-09-10 09:05:22",
|
|
|
- "resultPoundNo":"Bd123456780",
|
|
|
- "materialId":40
|
|
|
- --“IsAssembly”:”false”
|
|
|
- * }
|
|
|
- * @param mapList
|
|
|
- * @return
|
|
|
- */
|
|
|
- public int updateTruckWeight(List<Map<String, Object>> mapList){
|
|
|
- //遍历列表
|
|
|
- int count = 0;
|
|
|
- for (Map<String, Object> map : mapList) {
|
|
|
- //通过传来的运输订单号 与 物资ID查询计重实绩ID
|
|
|
- Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectTotalIdByOrderNo(map);
|
|
|
- map.putAll(stringObjectMap);
|
|
|
- try {
|
|
|
- TmstruckWeightResult tmstruckWeightResult = generateWeightResult(map);
|
|
|
- count += tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
- utilsService.pushMesToWebsocket((String) stringObjectMap.get("capacityNumber"), "计量");
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- return count;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成计量实体类
|
|
|
- * @param map
|
|
|
- * @return
|
|
|
- */
|
|
|
- public TmstruckWeightResult generateWeightResult(Map<String, Object> map) throws ParseException {
|
|
|
- TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
- tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
|
- //磅单号
|
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
- //如果计皮汽车衡不为空 查询汽车衡ID
|
|
|
- if(map.get("resultTareCalculateNumber") != null){
|
|
|
- Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
- tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
- }
|
|
|
- //如果计毛汽车衡不为空 查询计毛汽车衡
|
|
|
- if(map.get("resultCrossCalculateNumber") != null){
|
|
|
- Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultCrossCalculateNumber"));
|
|
|
- tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(crossId));
|
|
|
- }
|
|
|
- //毛重
|
|
|
- BigDecimal resultCrossWeight = DataChange.dataToBigDecimal(map.get("resultCrossWeight"));
|
|
|
- tmstruckWeightResult.setResultGrossWeight(resultCrossWeight);
|
|
|
- //皮重
|
|
|
- BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
- tmstruckWeightResult.setResultTareWeight(resultTareWeight);
|
|
|
- //净重
|
|
|
- tmstruckWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- //毛重时间
|
|
|
- Object resultCrossWeightTime = map.get("resultCrossWeightTime");
|
|
|
- if(resultCrossWeightTime != null)
|
|
|
- tmstruckWeightResult.setResultGrossWeightTime(sdf.parse((String) resultCrossWeightTime));
|
|
|
- //皮重时间
|
|
|
- Object resultTareWeightTime = map.get("resultTareWeightTime");
|
|
|
- if(resultTareWeightTime != null)
|
|
|
- tmstruckWeightResult.setResultTareWeightTime(sdf.parse((String) resultCrossWeightTime));
|
|
|
- //如果皮重毛重都有数据则是第二次计量设置更新 否则为第一次计量
|
|
|
- if(resultCrossWeight.intValue() != 0 && resultTareWeight.intValue() != 0){
|
|
|
- tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
- tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
- }else {
|
|
|
- tmstruckWeightResult.setInsertTime(new Date());
|
|
|
- tmstruckWeightResult.setInsertUsername("admin");
|
|
|
- }
|
|
|
- return tmstruckWeightResult;
|
|
|
- }
|
|
|
}
|