|
@@ -75,7 +75,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
//通过传来的运输订单号 与 物资ID查询计重实绩ID
|
|
|
Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectTotalIdByOrderNo(map);
|
|
|
if(stringObjectMap == null){
|
|
|
- throw new Exception("没有此订单信息或物资信息错误");
|
|
|
+ throw new Exception(map.get("orderNumber") + "没有此订单信息或物资信息(" + map.get("materialId") + ")错误");
|
|
|
}
|
|
|
map.putAll(stringObjectMap);
|
|
|
TmstruckWeightResult tmstruckWeightResult = generateWeightResult(map);
|
|
@@ -103,55 +103,60 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
*/
|
|
|
public TmstruckWeightResult generateWeightResult(Map<String, Object> map) throws Exception {
|
|
|
TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
|
|
|
+ BigDecimal orderType = DataChange.dataToBigDecimal(map.get("orderTypee"));
|
|
|
//磅单号
|
|
|
tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
|
|
|
- //如果计皮汽车衡不为空 查询汽车衡ID
|
|
|
- if(map.get("resultTareCalculateNumber") != null){
|
|
|
- Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
- if(tareId == null){
|
|
|
- throw new Exception("没有此皮重汽车衡");
|
|
|
- }
|
|
|
- tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
- }
|
|
|
- //如果计毛汽车衡不为空 查询计毛汽车衡
|
|
|
- if(map.get("resultCrossCalculateNumber") != null){
|
|
|
- Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultCrossCalculateNumber"));
|
|
|
- if(crossId == null){
|
|
|
- throw new Exception("没有此毛重汽车衡");
|
|
|
- }
|
|
|
- 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");
|
|
|
- //毛重时间
|
|
|
- if(map.get("resultCrossWeightTime") != null) {
|
|
|
+ //如果是采购订单 先计毛再计皮
|
|
|
+ if("5678".contains(orderType.toString())){
|
|
|
String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
- if(resultCrossWeightTime.contains(" "))
|
|
|
- resultCrossWeightTime = resultCrossWeightTime.replace(" ", " ");
|
|
|
- tmstruckWeightResult.setResultGrossWeightTime(sdf.parse(resultCrossWeightTime));
|
|
|
- }
|
|
|
- //皮重时间
|
|
|
- if(map.get("resultTareWeightTime") != null) {
|
|
|
- String resultTareWeightTime = (String) map.get("resultTareWeightTime");
|
|
|
- if(resultTareWeightTime.contains(" "))
|
|
|
- resultTareWeightTime = resultTareWeightTime.replace(" ", " ");
|
|
|
- tmstruckWeightResult.setResultTareWeightTime(sdf.parse(resultTareWeightTime));
|
|
|
- }
|
|
|
- //如果皮重毛重都有数据则是第二次计量设置更新 否则为第一次计量
|
|
|
- if(resultCrossWeight.intValue() != 0 && resultTareWeight.intValue() != 0){
|
|
|
- tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
- tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
- }else {
|
|
|
- tmstruckWeightResult.setInsertTime(new Date());
|
|
|
- tmstruckWeightResult.setInsertUsername("admin");
|
|
|
+ //如果毛重数据为空 则是第一次计量为毛重 此时第一次计量时间放皮重时间里面
|
|
|
+ if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
+ //设置毛重时间
|
|
|
+ String firstTime = (String) map.get("resultTareWeightTime");
|
|
|
+ tmstruckWeightResult.setResultGrossWeightTime(sdf.parse(firstTime));
|
|
|
+ //添加毛重汽车衡
|
|
|
+ Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
+ if(tareId == null){
|
|
|
+ throw new Exception("没有此汽车衡:" + map.get("resultTareCalculateNumber"));
|
|
|
+ }
|
|
|
+ tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
+ //设置毛重
|
|
|
+ BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
+ tmstruckWeightResult.setResultGrossWeight(resultTareWeight);
|
|
|
+ tmstruckWeightResult.setInsertTime(new Date());
|
|
|
+ tmstruckWeightResult.setInsertUsername("admin");
|
|
|
+ }else {
|
|
|
+ //设置皮重汽车衡
|
|
|
+ Integer tareId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultTareCalculateNumber"));
|
|
|
+ if(tareId == null){
|
|
|
+ throw new Exception("没有此皮重汽车衡:" + map.get("resultTareCalculateNumber"));
|
|
|
+ }
|
|
|
+ tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
+ //设置毛重汽车衡
|
|
|
+ Integer crossId = tmstruckWeightResultMapper.selectTruckCalculateId((String) map.get("resultCrossCalculateNumber"));
|
|
|
+ if(crossId == null){
|
|
|
+ throw new Exception("没有此毛重汽车衡:" + 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")));
|
|
|
+ //设置皮重时间
|
|
|
+ String resultTareWeightTime = (String) map.get("resultTareWeightTime");
|
|
|
+ tmstruckWeightResult.setResultTareWeightTime(sdf.parse(resultTareWeightTime));
|
|
|
+ //设置毛重时间
|
|
|
+ String resultGrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
+ tmstruckWeightResult.setResultGrossWeightTime(sdf.parse(resultGrossWeightTime));
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
+ }
|
|
|
}
|
|
|
return tmstruckWeightResult;
|
|
|
}
|