|
@@ -295,4 +295,111 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
|
|
tmstruckWeightResult.setUpdateTime(new Date());
|
|
tmstruckWeightResult.setUpdateTime(new Date());
|
|
tmstruckWeightResult.setUpdateUsername("admin");
|
|
tmstruckWeightResult.setUpdateUsername("admin");
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ *通过运输订单判断下一步是否需要计量,更新汽车衡到计量实绩中
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public int isNextNeedJl(BigDecimal orderId) {
|
|
|
|
+ //通过运输订单id获取路段顺序号、物资类型、计量实绩主键、line_id
|
|
|
|
+ Map<BigDecimal,String> map=tmstruckWeightResultMapper.selectByOrderId(orderId);
|
|
|
|
+ //通过运输订单id获取物资的类型
|
|
|
|
+ BigDecimal materialTypeId=new BigDecimal(map.get("materialTypeId").toString());
|
|
|
|
+ //获取路段顺序号
|
|
|
|
+ BigDecimal orderLineSequence=new BigDecimal(map.get("orderLineSequence").toString());
|
|
|
|
+ //计量实绩主键
|
|
|
|
+ BigDecimal weightTaskResultId=new BigDecimal(map.get("weightTaskResultId").toString());
|
|
|
|
+ //line_id
|
|
|
|
+ BigDecimal lineId=new BigDecimal(map.get("lineId").toString());
|
|
|
|
+ //通过运输线路判断下一步是否为计量,当前是啥,下下一步是啥
|
|
|
|
+ //如果下一步为计量,且当前步为进厂,则选择进厂称,如果下下步为出厂则选择出厂称,其他则选择中转称
|
|
|
|
+ List<BigDecimal> list=getNextStep(lineId,orderLineSequence.intValue());
|
|
|
|
+ if(list.size()==3){
|
|
|
|
+ //0:进厂;1:计毛;2:计皮;3:卸货;4:装货;5:出厂
|
|
|
|
+ if(list.get(1).intValue()==1 || list.get(1).intValue()==2){
|
|
|
|
+ //如果当前为进厂
|
|
|
|
+ if(list.get(0).intValue()==0){
|
|
|
|
+ //获取到汽车衡id
|
|
|
|
+ BigDecimal truckCalculateId =tmstruckWeightResultMapper.getTruckCalculateNumber(materialTypeId,new BigDecimal(1));
|
|
|
|
+ //将获取到的汽车衡id更新到计量实绩表中
|
|
|
|
+ //如果下一步为计毛作业
|
|
|
|
+ if(list.get(1).intValue()==1){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultGrossPlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ //如果下一步为计皮作业
|
|
|
|
+ if(list.get(1).intValue()==2){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultTarePlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //如果计量后一步为出厂
|
|
|
|
+ else if(list.get(2).intValue()==5){
|
|
|
|
+ //获取到汽车衡id
|
|
|
|
+ BigDecimal truckCalculateId =tmstruckWeightResultMapper.getTruckCalculateNumber(materialTypeId,new BigDecimal(2));
|
|
|
|
+ //将获取到的汽车衡id更新到计量实绩表中
|
|
|
|
+ //如果下一步为计毛作业
|
|
|
|
+ if(list.get(1).intValue()==1){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultGrossPlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ //如果下一步为计皮作业
|
|
|
|
+ if(list.get(1).intValue()==2){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultTarePlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ //获取到汽车衡id
|
|
|
|
+ BigDecimal truckCalculateId =tmstruckWeightResultMapper.getTruckCalculateNumber(materialTypeId,new BigDecimal(3));
|
|
|
|
+ //将获取到的汽车衡id更新到计量实绩表中
|
|
|
|
+ //如果下一步为计毛作业
|
|
|
|
+ if(list.get(1).intValue()==1){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultGrossPlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ //如果下一步为计皮作业
|
|
|
|
+ if(list.get(1).intValue()==2){
|
|
|
|
+ //通过订单号获取计量实绩主键,并更新
|
|
|
|
+ TmstruckWeightResult tmstruckWeightResult=new TmstruckWeightResult();
|
|
|
|
+ tmstruckWeightResult.setWeightTaskResultId(weightTaskResultId);
|
|
|
|
+ tmstruckWeightResult.setResultTarePlaceId(truckCalculateId);
|
|
|
|
+ tmstruckWeightResult.setUpdateTime(new Date());
|
|
|
|
+ tmstruckWeightResult.setUpdateUsername("admin");
|
|
|
|
+ tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<BigDecimal> getNextStep(BigDecimal lineId, int orderLineSequence) {
|
|
|
|
+ return tmstruckWeightResultMapper.getNextStep(lineId,orderLineSequence);
|
|
|
|
+ }
|
|
}
|
|
}
|