zhangyuewww пре 3 година
родитељ
комит
a34dce8348

+ 37 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranProcessInfoServiceImpl.java

@@ -12,10 +12,14 @@ import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
 import com.yh.saas.plugin.yiliangyiyun.entity.TranCarInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.TranProcessInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.TranSettlementReport;
+import com.yh.saas.plugin.yiliangyiyun.entity.TranTaskInfo;
 import com.yh.saas.plugin.yiliangyiyun.mapper.TranProcessInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.ITranCarInfoService;
 import com.yh.saas.plugin.yiliangyiyun.service.ITranProcessInfoService;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.yh.saas.plugin.yiliangyiyun.service.ITranSettlementReportService;
+import com.yh.saas.plugin.yiliangyiyun.service.ITranTaskInfoService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.mongodb.core.aggregation.ArrayOperators;
 import org.springframework.stereotype.Service;
@@ -40,6 +44,10 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
     private ICommonBillOperateHisService billOperateHisService;
     @Autowired
     private ITranCarInfoService tranCarInfoService;
+    @Autowired
+    private ITranTaskInfoService tranTaskInfoService;
+    @Autowired
+    private ITranSettlementReportService tranSettlementReportService;
     /**
      * 汽运调度分页列表查询
      * @param tranProcessInfo
@@ -160,6 +168,35 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                     if(tranCarInfo.getLoadNetWeight()>0){
                         tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
                         tranCarInfo.setStatus(StatusEnum.LOADED.getName());
+                        List<TranSettlementReport> tranSettlementReportList=tranSettlementReportService.selectList(new EntityWrapper<TranSettlementReport>()
+                                .eq("car_id",tranCarInfo.getId()));
+                        if (!CollectionUtils.isEmpty(tranSettlementReportList))
+                        {
+                            for (TranSettlementReport tranSettlementReport:tranSettlementReportList){
+                                tranSettlementReport.setUnloadingWeight(tranCarInfo.getUnloadNetWeight());
+                                tranSettlementReport.setUnloadingImg(tranCarInfo.getUnloadPoundImg());
+                                tranSettlementReport.setLossWeight(tranCarInfo.getLoadNetWeight()-tranCarInfo.getUnloadNetWeight());
+                                tranSettlementReportService.updateById(tranSettlementReport);
+                            }
+                        }
+                        else {
+                            //生成汽运报表
+                            TranSettlementReport tranSettlementReport=new TranSettlementReport();
+                            TranTaskInfo tranTaskInfo=tranTaskInfoService.selectById(tranProcessInfo.getInfoId());
+                            tranSettlementReport.setCompId(tranTaskInfo.getCompId());
+                            tranSettlementReport.setCarId(tranCarInfo.getId());
+                            tranSettlementReport.setId(IdGenerator.generateUUID());
+                            tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
+                            tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                            tranSettlementReport.setName(tranCarInfo.getDriver());
+                            tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
+                            tranSettlementReport.setCarNo(tranCarInfo.getCarNo());
+                            tranSettlementReport.setTranCarNo(tranCarInfo.getTranCarNo());
+                            tranSettlementReport.setLoadingWeight(tranCarInfo.getLoadNetWeight());
+                            tranSettlementReport.setLoadingImg(tranCarInfo.getLoadPoundImg());
+                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
+                            tranSettlementReportService.insert(tranSettlementReport);
+                        }
                     }
                     //卸车反馈时状态改为已送达
                     if(tranCarInfo.getUnloadNetWeight()>0){