|
@@ -91,10 +91,14 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
* @return
|
|
|
*/
|
|
|
public String addTruckWeightResult(Map<String, Object> map) {
|
|
|
- //通过传来的运输订单号 与 物资ID查询计重实绩ID
|
|
|
- Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectTotalIdByOrderNo(map);
|
|
|
+ //通过运输订单号查询计量实绩Id
|
|
|
+ Map<String, Object> stringObjectMap = tmstruckWeightResultMapper.selectWeightIdByOrderId(map);
|
|
|
if(stringObjectMap == null){
|
|
|
- return map.get("orderNumber") + "没有此订单信息或物资信息(" + map.get("materialId") + ")错误";
|
|
|
+ //通过传来的运输订单号 与 物资ID查询计重实绩ID
|
|
|
+ stringObjectMap = tmstruckWeightResultMapper.selectTotalIdByOrderNo(map);
|
|
|
+ if(stringObjectMap == null){
|
|
|
+ return map.get("orderNumber") + "没有此订单信息或物资信息(" + map.get("materialId") + ")错误";
|
|
|
+ }
|
|
|
}
|
|
|
map.putAll(stringObjectMap);
|
|
|
TmstruckWeightResult tmstruckWeightResult = null;
|
|
@@ -117,30 +121,20 @@ 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"));
|
|
|
String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
|
|
|
+ tmstruckWeightResult.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
|
|
|
//如果是采购订单 先计毛再计皮
|
|
|
- if("5678".contains(orderType.toString()) || orderType.intValue() == 12 || orderType.intValue() == 14){
|
|
|
+ if("56789".contains(orderType.toString())
|
|
|
+ || orderType.intValue() == 12
|
|
|
+ || orderType.intValue() == 14
|
|
|
+ ){
|
|
|
//如果毛重数据为空 则是第一次计量为毛重 此时第一次计量时间放皮重时间里面
|
|
|
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.setResultGrossPlaceId(new BigDecimal(tareId));
|
|
|
- //设置毛重
|
|
|
- BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
- tmstruckWeightResult.setResultGrossWeight(resultTareWeight);
|
|
|
- tmstruckWeightResult.setInsertTime(new Date());
|
|
|
- tmstruckWeightResult.setInsertUsername("admin");
|
|
|
+ addMaoWeightResult(tmstruckWeightResult, map);
|
|
|
//更新订单中路段顺序号
|
|
|
map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
utilsService.updateOrderLineSequence(map);
|
|
@@ -157,7 +151,43 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
autoReceipt(orderNumber);
|
|
|
}
|
|
|
}
|
|
|
- }else{
|
|
|
+ }
|
|
|
+ else if(orderType.intValue() == 10){
|
|
|
+ //查询还有几条没有净重的实绩
|
|
|
+ Integer resultNum = tmstruckWeightResultMapper.selectNoNetWeightResult((String) map.get("orderNumber"));
|
|
|
+ if(resultNum == 2){
|
|
|
+ //如果有两条则是走先计皮后计毛顺序
|
|
|
+ addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据 (正常添加对应皮毛重方法)
|
|
|
+ if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
+ map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
|
|
|
+ }else{
|
|
|
+ map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
+ }
|
|
|
+ utilsService.updateOrderLineSequence(map);
|
|
|
+ }else{
|
|
|
+ //只剩一条数据时则是计毛后计皮顺序
|
|
|
+ //如果毛重数据为空 则是第一次计量为毛重 此时第一次计量时间放皮重时间里面
|
|
|
+ if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
|
+ addMaoWeightResult(tmstruckWeightResult, map);
|
|
|
+ //更新订单中路段顺序号
|
|
|
+ map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
|
|
|
+ utilsService.updateOrderLineSequence(map);
|
|
|
+ }else {
|
|
|
+ addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据
|
|
|
+ //更新订单中路段顺序号
|
|
|
+ map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
|
|
|
+ utilsService.updateOrderLineSequence(map);
|
|
|
+ String orderNumber = (String) map.get("orderNumber");
|
|
|
+ //如果是采购订单 计皮后自动完成签收
|
|
|
+ //查询是此订单是否已签收过
|
|
|
+ Integer check = utilsMapper.checkoutReceipt(orderNumber);
|
|
|
+ if(check == null){
|
|
|
+ autoReceipt(orderNumber);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else{
|
|
|
addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据
|
|
|
// 更新订单中路段顺序号,如果毛重时间为空则为计皮:也就是销售第一次计皮,反之有毛重时间则为计毛
|
|
|
if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
|
|
@@ -170,6 +200,29 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
return tmstruckWeightResult;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 添加第一次为毛重数据的计量实绩
|
|
|
+ * @param tmstruckWeightResult
|
|
|
+ * @param map
|
|
|
+ */
|
|
|
+ public void addMaoWeightResult(TmstruckWeightResult tmstruckWeightResult, Map<String, Object> map) throws Exception{
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ //设置毛重时间
|
|
|
+ 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.setResultGrossPlaceId(new BigDecimal(tareId));
|
|
|
+ //设置毛重
|
|
|
+ BigDecimal resultTareWeight = DataChange.dataToBigDecimal(map.get("resultTareWeight"));
|
|
|
+ tmstruckWeightResult.setResultGrossWeight(resultTareWeight);
|
|
|
+ tmstruckWeightResult.setInsertTime(new Date());
|
|
|
+ tmstruckWeightResult.setInsertUsername("admin");
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 添加计量实绩添加数据
|
|
|
* @param tmstruckWeightResult
|
|
@@ -189,7 +242,6 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
tmstruckWeightResult.setResultTarePlaceId(new BigDecimal(tareId));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
//设置毛重汽车衡
|
|
|
String resultCrossCalculateNumber = (String) map.get("resultCrossCalculateNumber");
|
|
|
if(resultCrossCalculateNumber != null){
|
|
@@ -203,15 +255,22 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
}
|
|
|
//毛重
|
|
|
if(map.get("resultCrossWeight") != null){
|
|
|
- tmstruckWeightResult.setResultGrossWeight(DataChange.dataToBigDecimal(map.get("resultCrossWeight")));
|
|
|
+ String resultCrossWeight = (String) map.get("resultCrossWeight");
|
|
|
+ if(!"".equals(resultCrossWeight))
|
|
|
+ tmstruckWeightResult.setResultGrossWeight(DataChange.dataToBigDecimal(resultCrossWeight));
|
|
|
}
|
|
|
//皮重
|
|
|
if(map.get("resultTareWeight") != null){
|
|
|
- tmstruckWeightResult.setResultTareWeight(DataChange.dataToBigDecimal(map.get("resultTareWeight")));
|
|
|
+ String resultTareWeight = (String) map.get("resultTareWeight");
|
|
|
+ if(!"".equals(resultTareWeight))
|
|
|
+ tmstruckWeightResult.setResultTareWeight(DataChange.dataToBigDecimal(resultTareWeight));
|
|
|
}
|
|
|
//净重
|
|
|
if(map.get("resultNetWeight") != null){
|
|
|
- tmstruckWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(map.get("resultNetWeight")));
|
|
|
+ String resultNetWeight = (String) map.get("resultNetWeight");
|
|
|
+ if(!"".equals(resultNetWeight)){
|
|
|
+ tmstruckWeightResult.setResultNetWeight(DataChange.dataToBigDecimal(resultNetWeight));
|
|
|
+ }
|
|
|
}
|
|
|
//设置皮重时间
|
|
|
if(map.get("resultTareWeightTime") != null){
|
|
@@ -294,7 +353,7 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
//设置毛重时间
|
|
|
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"));
|
|
@@ -306,13 +365,13 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
|
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"));
|