|
@@ -1,5 +1,6 @@
|
|
package com.steerinfo.dil.service.impl;
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
|
|
+import com.steerinfo.dil.mapper.RulesMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckReceiptResultMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckWeightResultMapper;
|
|
import com.steerinfo.dil.mapper.TmstruckWeightResultMapper;
|
|
import com.steerinfo.dil.model.TmstruckReceiptResult;
|
|
import com.steerinfo.dil.model.TmstruckReceiptResult;
|
|
@@ -42,7 +43,12 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
private UtilsServiceImpl utilsService;
|
|
private UtilsServiceImpl utilsService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private TmstruckLeaveFactoryResultServiceImpl tmstruckLeaveFactoryResultService;
|
|
|
|
|
|
+ private RulesServiceImpl rulesService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private RulesMapper rulesMapper;
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询所有计毛实绩
|
|
* 查询所有计毛实绩
|
|
* @param map
|
|
* @param map
|
|
@@ -134,22 +140,11 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
return tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
|
|
return tmstruckWeightResultMapper.insertSelective(tmstruckWeightResult);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 通过物资ID获取对应汽车衡 如果有多个汽车衡中随机选择
|
|
|
|
- * @param materialId
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public int getCalculateIdByMaterial(BigDecimal materialId) {
|
|
|
|
- List<Integer> calculateIdList = tmstruckWeightResultMapper.getCalculateIdByMaterial(materialId);
|
|
|
|
- return calculateIdList.get((int)(Math.random()*calculateIdList.size()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 更新计毛实绩 采集需要的数据
|
|
* 更新计毛实绩 采集需要的数据
|
|
* 运输订单号
|
|
* 运输订单号
|
|
* 汽车衡编号
|
|
* 汽车衡编号
|
|
- * //物资名称
|
|
|
|
|
|
+ * 物资名称
|
|
* 毛重
|
|
* 毛重
|
|
* 毛重时间
|
|
* 毛重时间
|
|
* 磅单号
|
|
* 磅单号
|
|
@@ -164,36 +159,24 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
map.put("materialId", materialId);
|
|
map.put("materialId", materialId);
|
|
//通过传来的运输订单号与物资ID查询计重实绩
|
|
//通过传来的运输订单号与物资ID查询计重实绩
|
|
map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
- BigDecimal weightTaskResultId = DataChange.dataToBigDecimal(map.get("weightTaskResultId"));
|
|
|
|
- tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
- //添加毛重
|
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
|
- String resultGrossWeight = df.format((double) map.get("resultGrossWeight"));
|
|
|
|
- tmstruckWeightResult.setResultGrossWeight(new BigDecimal(resultGrossWeight));
|
|
|
|
- //添加毛重时间
|
|
|
|
- long resultGrossWeightTime = (long) map.get("resultGrossWeightTime");
|
|
|
|
- tmstruckWeightResult.setResultGrossWeightTime(new Date(resultGrossWeightTime));
|
|
|
|
-
|
|
|
|
- //通过汽车衡编号查询汽车衡ID
|
|
|
|
- Integer calculateId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("truckCalculateNumber"));
|
|
|
|
- //添加计毛汽车衡
|
|
|
|
- if(calculateId != null){
|
|
|
|
- tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(calculateId));
|
|
|
|
- }
|
|
|
|
|
|
+ generateMaoWeightResult(map, tmstruckWeightResult);
|
|
Integer lineSequence = null; //路段顺序号
|
|
Integer lineSequence = null; //路段顺序号
|
|
|
|
+ BigDecimal orderId = DataChange.dataToBigDecimal(map.get("orderId"));
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
switch (orderType.intValue()){
|
|
switch (orderType.intValue()){
|
|
- //如果订单类型为销售订单 则执行销售订单计皮规则 resultTareWeight
|
|
|
|
case 1:
|
|
case 1:
|
|
- //计算净重 从map中获取皮重 tareWeight
|
|
|
|
- double netWeight = ((BigDecimal) map.get("resultGrossWeight")).doubleValue() - ((Double) map.get("tareWeight"));
|
|
|
|
- String resultNetWeight = df.format(netWeight);
|
|
|
|
- tmstruckWeightResult.setResultNetWeight(new BigDecimal(resultNetWeight));
|
|
|
|
- addUpdateRegularField(tmstruckWeightResult); //插入第二次计重时间
|
|
|
|
-// lineSequence = 5; //设置路段顺序号为5:出厂
|
|
|
|
|
|
+ //添加第二次计量常规字段
|
|
|
|
+ addUpdateRegularField(tmstruckWeightResult);
|
|
|
|
+ //查询当前订单路段顺序号 +1 代表本阶段已完成
|
|
|
|
+ lineSequence = utilsService.getLineSequenceByOrderId(orderId) + 1;
|
|
|
|
+ //查询当前计毛是否为最后一拼(针对多拼) (查询是否还有装车实绩没有数据)
|
|
|
|
+ List<Map<String, Object>> list = rulesMapper.judgeLastMaterial(orderId);
|
|
|
|
+ if(list.size() != 0){
|
|
|
|
+ //如果还有未装车的实绩 则代表还有未装车的物资 计算各个物资装车点 并更新到装车实绩中
|
|
|
|
+
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
- break;
|
|
|
|
case 3:
|
|
case 3:
|
|
break;
|
|
break;
|
|
case 4:
|
|
case 4:
|
|
@@ -202,9 +185,8 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
case 6:
|
|
case 6:
|
|
case 7:
|
|
case 7:
|
|
case 8: //采购订单记录计毛为第一次计重 添加磅单号
|
|
case 8: //采购订单记录计毛为第一次计重 添加磅单号
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
|
addInsertRegularField(tmstruckWeightResult); //插入第一次计重时间常规字段
|
|
addInsertRegularField(tmstruckWeightResult); //插入第一次计重时间常规字段
|
|
- lineSequence = 5; //设置路段顺序号为3:卸货
|
|
|
|
|
|
+ lineSequence = utilsService.getLineSequenceByOrderId(orderId) + 1;
|
|
break;
|
|
break;
|
|
case 9:
|
|
case 9:
|
|
break;
|
|
break;
|
|
@@ -213,7 +195,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
case 11:
|
|
case 11:
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
int i = tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
int i = tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
//更新订单路段顺序号
|
|
//更新订单路段顺序号
|
|
int i2 = utilsService.updateOrderLineSequence(map, lineSequence);
|
|
int i2 = utilsService.updateOrderLineSequence(map, lineSequence);
|
|
@@ -221,15 +202,36 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 通过物资名称和规格型号查询物资Id
|
|
|
|
- * 物资名称:materialName 规格型号:materialSpecification
|
|
|
|
|
|
+ * 生成计毛实体类
|
|
|
|
+ * @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public int queryMaterialIdByMNameAndCode(Map<String, Object> map){
|
|
|
|
- return tmstruckWeightResultMapper.getMaterialIdByMaterialNameAndSpe(map);
|
|
|
|
|
|
+ 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((double) map.get("resultGrossWeight"));
|
|
|
|
+ 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
|
|
|
|
+ Integer calculateId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("truckCalculateNumber"));
|
|
|
|
+ //添加计毛汽车衡
|
|
|
|
+ if(calculateId != null){
|
|
|
|
+ tmstruckWeightResult.setResultGrossPlaceId(new BigDecimal(calculateId));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 更新计皮实绩 需要采集的数据
|
|
* 更新计皮实绩 需要采集的数据
|
|
* 运输订单号 orderNumber
|
|
* 运输订单号 orderNumber
|
|
@@ -237,6 +239,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
* 皮重 resultTareWeight
|
|
* 皮重 resultTareWeight
|
|
* 皮重时间 resultTareWeightTime
|
|
* 皮重时间 resultTareWeightTime
|
|
* 净重
|
|
* 净重
|
|
|
|
+ * 物资名称 物资规格型号
|
|
* @param map
|
|
* @param map
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -249,27 +252,16 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
map.put("materialId", materialId);
|
|
map.put("materialId", materialId);
|
|
//通过传来的运输订单号与物资ID查询计重实绩
|
|
//通过传来的运输订单号与物资ID查询计重实绩
|
|
map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
map.putAll(tmstruckWeightResultMapper.selectTotalIdByOrderNo(map));
|
|
- 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));
|
|
|
|
- //通过汽车衡编号查询汽车衡ID 添加计皮汽车衡
|
|
|
|
- Integer calculateId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("truckCalculateNumber"));
|
|
|
|
- if(calculateId != null){
|
|
|
|
- tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(calculateId));
|
|
|
|
- }
|
|
|
|
|
|
+ generatePiWeightResult(map, tmstruckWeightResult);
|
|
int i = 0;
|
|
int i = 0;
|
|
Integer lineSequence = null; //路段顺序号
|
|
Integer lineSequence = null; //路段顺序号
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
switch (orderType.intValue()){
|
|
switch (orderType.intValue()){
|
|
- case 1: //销售订单计皮为第一次计重
|
|
|
|
- tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
|
|
|
+ case 1:
|
|
|
|
+ //销售订单计皮为第一次计重
|
|
addInsertRegularField(tmstruckWeightResult);// 添加插入常规字段 就是第一次计重时间
|
|
addInsertRegularField(tmstruckWeightResult);// 添加插入常规字段 就是第一次计重时间
|
|
|
|
+ //查询当前订单路段顺序号 +1 代表本阶段已完成
|
|
|
|
+ lineSequence = utilsService.getLineSequenceByOrderId(DataChange.dataToBigDecimal(map.get("orderId"))) + 1;
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
break;
|
|
break;
|
|
@@ -280,22 +272,14 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
case 5:
|
|
case 5:
|
|
case 6:
|
|
case 6:
|
|
case 7:
|
|
case 7:
|
|
- case 8: //如果订单类型为采购订单 则执行采购订单计皮规则
|
|
|
|
- //计算净重 先从map中获取毛重 grossWeight
|
|
|
|
- double netWeight = ((BigDecimal) map.get("grossWeight")).doubleValue() - ((Double) map.get("resultTareWeight"));
|
|
|
|
- String resultNetWeight = df.format(netWeight);
|
|
|
|
- tmstruckWeightResult.setResultNetWeight(new BigDecimal(resultNetWeight));
|
|
|
|
|
|
+ case 8:
|
|
|
|
+ //如果订单类型为采购订单 则执行采购订单计皮规则
|
|
addUpdateRegularField(tmstruckWeightResult); // 添加更新常规字段 就是第二次计重时间
|
|
addUpdateRegularField(tmstruckWeightResult); // 添加更新常规字段 就是第二次计重时间
|
|
//计皮作业完成后自动完成签收
|
|
//计皮作业完成后自动完成签收
|
|
- TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
|
|
|
|
- tmstruckReceiptResult.setResultTotalId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
|
|
- tmstruckReceiptResult.setStatus(new BigDecimal(1));
|
|
|
|
- tmstruckReceiptResult.setInsertUsername("admin");
|
|
|
|
- tmstruckReceiptResult.setInsertTime(new Date());
|
|
|
|
- i += tmstruckReceiptResultMapper.updateByTotalResultId(tmstruckReceiptResult);
|
|
|
|
- lineSequence = 5; // 出厂
|
|
|
|
|
|
+ i += autoReceipt(DataChange.dataToBigDecimal(map.get("resultTotalId")));
|
|
//计皮完成后计算出厂门岗并更新实绩出厂门岗ID
|
|
//计皮完成后计算出厂门岗并更新实绩出厂门岗ID
|
|
- i += tmstruckLeaveFactoryResultService.calculateGatepost(map);
|
|
|
|
|
|
+ i += rulesService.calculateGatepost(map);
|
|
|
|
+ lineSequence = 5; // 出厂
|
|
break;
|
|
break;
|
|
case 9:
|
|
case 9:
|
|
break;
|
|
break;
|
|
@@ -310,6 +294,50 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
return i;
|
|
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));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 自动签收
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public int autoReceipt(BigDecimal resultTotalId){
|
|
|
|
+ TmstruckReceiptResult tmstruckReceiptResult = new TmstruckReceiptResult();
|
|
|
|
+ tmstruckReceiptResult.setResultTotalId(resultTotalId);
|
|
|
|
+ tmstruckReceiptResult.setStatus(new BigDecimal(1));
|
|
|
|
+ tmstruckReceiptResult.setInsertUsername("admin");
|
|
|
|
+ tmstruckReceiptResult.setInsertTime(new Date());
|
|
|
|
+ return tmstruckReceiptResultMapper.updateByTotalResultId(tmstruckReceiptResult);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 添加首次计重时的常规字段
|
|
* 添加首次计重时的常规字段
|
|
* @param tmstruckWeightResult
|
|
* @param tmstruckWeightResult
|