zhangyuewww 2 lat temu
rodzic
commit
e98ed2cf1f

+ 4 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TranSettlementReport.java

@@ -55,6 +55,10 @@ public class TranSettlementReport extends BaseModel<TranSettlementReport> {
      * 合同编号
      */
     private String contractNo;
+    /**
+     * 计费方式(1按吨,2按车)
+     */
+    private String billingMethod;
     /**
      * 运输任务编号
      */

+ 1 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ContractManagementInfoServiceImpl.java

@@ -3204,7 +3204,7 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
                         .eq("contract_no", contractManagementInfo.getContractNo()));
                 if (tranTaskInfo!=null) {
                     contractManagementInfo.setTranTaskFlag("1");
-                    //查合同下的车牌号,退库
+                    //查合同下的车牌号,退库只能选到未入库的
                     List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
                             .eq("info_id", tranTaskInfo.getId()).eq("fleet_flag", "0").eq("tran_type", "1").eq("submit", "0")
                             .last("ORDER BY CONVERT ( car_no USING gbk ) ASC"));

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

@@ -302,6 +302,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                         tranCarInfo.setSignStatusFlag(StatusEnum.NOT_SIGNED.getFlag());
                     }
                     TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranProcessInfo.getInfoId());
+                    TranProcessInfo tranProcessInfo1=this.selectById(tranProcessInfo.getId());
                     //装车反馈时状态改为已装车
                     if (tranCarInfo.getLoadNetWeight() > 0&&tranCarInfo.getUnloadNetWeight() == 0) {
                         tranCarInfo.setStatusFlag(StatusEnum.LOADED.getFlag());
@@ -348,7 +349,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                 tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                tranSettlementReport.setGrainPrice(tranProcessInfo1.getGoodsValue());
 //                                ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
 //                                        .eq("contract_no", tranSettlementReport.getContractNo())
 //                                        .eq("delete_flag", "0"));
@@ -386,21 +387,29 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 }
                                 tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight());
                                 tranSettlementReport.setServiceCharge(20d);
-                                //应付
-                                tranSettlementReport.setAmountIngPayable(Float.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight());
-                                //实付金额
-                                if(tranSettlementReport.getDeductionAmount() != null){
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
-                                }else{
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
+                                //按吨计费
+                                if("1".equals(tranCarInfo.getBillingMethod())) {
+                                    //应付
+                                    tranSettlementReport.setAmountIngPayable(Float.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight());
+                                }
+                                //按车
+                                else{
+                                    //应付
+                                    tranSettlementReport.setAmountIngPayable(Float.valueOf(tranCarInfo.getTranPrice()));
+                                }
+                                //实付金额=应付-扣款-服务费
+                                if (tranSettlementReport.getDeductionAmount() != null) {
+                                    tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                            - tranSettlementReport.getDeductionAmount() - tranSettlementReport.getServiceCharge());
+                                } else {
+                                    tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
                                             - tranSettlementReport.getServiceCharge());
                                 }
-                                //税点
-                                tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                //合计应付
-                                tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
-                                //未付
+                                //税点=实付÷0.946×0.054
+                                tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid() / 0.946 * 0.054);
+                                //合计应付=实付+税点
+                                tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid() + tranSettlementReport.getTaxPoint());
+                                //未付=合计应付
                                 tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                                 tranSettlementReport.setTranCarNo(tranCarInfo.getTranCarNo());
                                 tranSettlementReport.setLoadingWeight(tranCarInfo.getLoadNetWeight());
@@ -408,6 +417,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
                                 tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
                                 tranSettlementReport.setBatchId(batchReviewInfo.getId());
+                                tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                                 tranSettlementReportService.insert(tranSettlementReport);
                                 flagBatch = "1";
 //                                boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(tranSettlementReport.getWorkflowId());
@@ -445,13 +455,12 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setId(IdGenerator.generateUUID());
                                 tranSettlementReport.setTranType("火运");
                                 tranSettlementReport.setTranTypeKey("2");
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                tranSettlementReport.setGrainPrice(tranProcessInfo1.getGoodsValue());
                                 tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                                tranSettlementReport.setProcessNo(tranProcessInfo1.getProcessNo());
                                 tranSettlementReport.setBoxNo(tranCarInfo.getBoxNo());
                                 tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight());
-                                TranProcessInfo tranProcessInfo1 = this.selectById(tranProcessInfo.getId());
                                 //应付
                                 tranSettlementReport.setAmountIngPayable(tranProcessInfo1.getTranPrice());
                                 //未付
@@ -475,11 +484,11 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setCompId(tranTaskInfo.getCompId());
                                 tranSettlementReport.setCarId(tranCarInfo.getId());
                                 tranSettlementReport.setId(IdGenerator.generateUUID());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                tranSettlementReport.setGrainPrice(tranProcessInfo1.getGoodsValue());
                                 tranSettlementReport.setTranType("船运");
                                 tranSettlementReport.setTranTypeKey("3");
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                                tranSettlementReport.setProcessNo(tranProcessInfo1.getProcessNo());
                                 if ("集装箱".equals(tranCarInfo.getShipType())){
                                     tranSettlementReport.setBoxNo(tranCarInfo.getCaseNo());
                                 }
@@ -489,7 +498,6 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setShipType(tranCarInfo.getShipType());
                                 tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
                                 tranSettlementReport.setSettlementWeight(tranCarInfo.getLoadNetWeight());
-                                TranProcessInfo tranProcessInfo1=this.selectById(tranProcessInfo.getId());
                                 //应付
                                 tranSettlementReport.setAmountIngPayable(tranProcessInfo1.getTranPrice());
                                 //未付
@@ -523,8 +531,8 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                     tranSettlementReport1.setLossWeight(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight());
                                     //汽运类型
                                     if (tranCarInfo.getTranType().equals(NumberConstant.CONSTANT1)) {
-                                        //结算重量
-                                        if ("0".equals(tranSettlementReport1.getManualFlag())) {
+                                        //未手动修改过结算重量
+                                        if ("0".equals(tranSettlementReport1.getManualFlag())){
                                             //卸车不为空时,结算重量=装卸取小
                                             tranSettlementReport1.setSettlementWeight(tranCarInfo.getLoadNetWeight() > tranCarInfo.getUnloadNetWeight() ? tranCarInfo.getUnloadNetWeight() : tranCarInfo.getLoadNetWeight());
                                             tranSettlementReport1.setTransportDamage(tranSettlementReport1.getSettlementWeight() * 0.001);
@@ -539,6 +547,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                             tranSettlementReport1.setCargoDamage(tranSettlementReport1.getLossWeight() - tranSettlementReport1.getSettlementWeight() * 0.001);
                                             //实际损耗默认为结算重量的1‰
                                             tranSettlementReport1.setActualLoss(tranSettlementReport1.getSettlementWeight() * 0.001);
+                                            //扣款=货损×货值=(损耗-结算重量×0.001)×货值
                                             if (tranSettlementReport1.getGrainPrice() != null) {
                                                 tranSettlementReport1.setDeductionAmount(tranSettlementReport1.getCargoDamage() * tranSettlementReport1.getGrainPrice());
                                             } else {
@@ -551,20 +560,18 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                             tranSettlementReport1.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport1.getLossWeight())));
                                             tranSettlementReport1.setDeductionAmount(0d);
                                         }
-                                        //扣款
-                                        if (tranSettlementReport1.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
-                                            //应付=单价x结算重量-扣款
+                                        //按吨计费
+                                        if("1".equals(tranCarInfo.getBillingMethod())) {
+                                            //应付=单价x结算重量
                                             tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
-                                            //实付金额
-                                            tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                                                    - tranSettlementReport1.getServiceCharge());
-                                        } else {
-                                            //应付=单价x结算重量-扣款
-                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight() - Float.valueOf(String.valueOf(tranSettlementReport1.getDeductionAmount())));
-                                            //实付金额
-                                            tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                                                    - Double.valueOf(tranSettlementReport1.getDeductionAmount()) - tranSettlementReport1.getServiceCharge());
                                         }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport1.getDeductionAmount())) - tranSettlementReport1.getServiceCharge());
                                         //税点
                                         tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
                                         //合计应付
@@ -586,8 +593,8 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                             tranSettlementReport.setTranTypeKey("1");
                             tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                             tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
-                            tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
-                            tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
+                            tranSettlementReport.setProcessNo(tranProcessInfo1.getProcessNo());
+                            tranSettlementReport.setGrainPrice(tranProcessInfo1.getGoodsValue());
                             tranSettlementReport.setName(tranCarInfo.getDriver());
                             tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
                             tranSettlementReport.setCarNo(tranCarInfo.getCarNo());
@@ -621,19 +628,21 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                             //扣款
                             if (tranSettlementReport.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
                                 tranSettlementReport.setDeductionAmount(0d);
-                                //应付=单价x结算重量-扣款
-                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
-                                //实付金额
-                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * Double.valueOf(tranSettlementReport.getSettlementWeight())
-                                         - tranSettlementReport.getServiceCharge());
                             } else {
                                 tranSettlementReport.setDeductionAmount(Double.valueOf(String.valueOf(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight() - (tranCarInfo.getLoadNetWeight() / 1000) * Float.valueOf(tranCarInfo.getTranPrice()))));
-                                //应付=单价x结算重量-扣款
-                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())));
-                                //实付金额
-                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * Double.valueOf(tranSettlementReport.getSettlementWeight())
-                                        - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
                             }
+                            //按吨计费
+                            if("1".equals(tranCarInfo.getBillingMethod())) {
+                                //应付=单价x结算重量
+                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                            }
+                            //按车
+                            else{
+                                //应付
+                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                            }
+                            //实付金额=应付-扣款-服务费
+                            tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
                             //税点
                             tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
                             //合计应付
@@ -641,6 +650,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                             //未付
                             tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                             tranSettlementReport.setBatchId(batchReviewInfo.getId());
+                            tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                             tranSettlementReportService.insert(tranSettlementReport);
                             flagBatch="1";
 //                            boolean isStartWorkflow = org.apache.commons.lang3.StringUtils.isBlank(tranSettlementReport.getWorkflowId());
@@ -668,7 +678,6 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
 //                            }
                         }
                     }
-                    TranProcessInfo tranProcessInfo1 = this.selectById(tranProcessInfo.getId());
                     //粮款结算阶段
 //                  if ("1".equals(tranProcessInfo1.getEndFlag())) {
                     CommonStaff commonStaff = staffService.getInfo(AuthSecurityUtils.getCurrentUserId());

+ 48 - 7
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranSettlementReportServiceImpl.java

@@ -298,10 +298,31 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 tranPriceApproveService.insert(tranPriceApprove);
                 tranSettlementReport1.setSettlementWeight(tranSettlementReport.getSettlementWeight());
                 tranSettlementReport1.setManualFlag("1");
-                //应付=单价x结算重量-扣款
-                tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(String.valueOf(tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : 0d)));
+                //修改结算重量影响损耗:损耗大于结算重量的1‰时
+                if (tranSettlementReport1.getLossWeight()>tranSettlementReport.getSettlementWeight()*0.001){
+                    //货损=损耗-结算重量x1‰
+                    tranSettlementReport1.setCargoDamage(tranSettlementReport1.getLossWeight()-tranSettlementReport.getSettlementWeight()*0.001);
+                    //实际损耗默认为结算重量的1‰
+                    tranSettlementReport1.setActualLoss(tranSettlementReport.getSettlementWeight()*0.001);
+                    if (tranSettlementReport1.getGrainPrice()!=null){
+                        tranSettlementReport1.setDeductionAmount(tranSettlementReport1.getCargoDamage()*tranSettlementReport1.getGrainPrice());
+                    }
+                    else{
+                        tranSettlementReport1.setDeductionAmount(0d);
+                    }
+                }
+                //按吨计费
+                if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                    //应付=单价x结算重量
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                }
+                //按车
+                else{
+                    //应付
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                }
                 //实付金额
-                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
+                tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
                         - (tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : 0d)- tranSettlementReport1.getServiceCharge());
                 //税点
                 tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
@@ -319,11 +340,21 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
             else if (tranSettlementReport.getFlag() == 1) {
                 tranSettlementReport1.setManualIdentification("1");
                 tranSettlementReport1.setDeductionAmount(tranSettlementReport.getDeductionAmount());
+                //按吨计费
+                if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                    //应付=单价x结算重量
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                }
+                //按车
+                else{
+                    //应付
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                }
 //                tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getSettlementWeight()*tranSettlementReport1.getTransportPrice()-Float.valueOf(tranSettlementReport1.getDeductionAmount()));
 //                tranSettlementReport1.setAmountNotPayable(tranSettlementReport1.getAmountIngPayable()-tranSettlementReport1.getAmountEdPayable());
                 //实付金额
-                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                        - (tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : 0d) - tranSettlementReport1.getServiceCharge());
+                tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                        - (tranSettlementReport.getDeductionAmount() != null ? tranSettlementReport.getDeductionAmount() : 0d) - tranSettlementReport1.getServiceCharge());
                 //税点
                 tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
                 //合计应付
@@ -351,9 +382,19 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
             //4 修改服务费
             else if (tranSettlementReport.getFlag() == 4){
                 tranSettlementReport1.setServiceCharge(tranSettlementReport.getServiceCharge());
+                //按吨计费
+                if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                    //应付=单价x结算重量
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                }
+                //按车
+                else{
+                    //应付
+                    tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                }
                 //实付金额
-                tranSettlementReport1.setAmountActuallyPaid(Double.valueOf(tranSettlementReport1.getTransportPrice()) * tranSettlementReport1.getSettlementWeight()
-                        - (tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : 0d) - tranSettlementReport1.getServiceCharge());
+                tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                        - (tranSettlementReport1.getDeductionAmount() != null ? tranSettlementReport1.getDeductionAmount() : 0d) - tranSettlementReport.getServiceCharge());
                 //税点
                 tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
                 //合计应付

+ 617 - 247
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -973,7 +973,7 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             tranSettlementReport.setLossWeight(tranSettlementReport.getLoadingWeight() - tranSettlementReport.getUnloadingWeight());
                             //汽运类型
                             if (tranSettlementReport.getTranTypeKey().equals(NumberConstant.CONSTANT1)) {
-                                //结算重量
+                                //未手动修改过结算重量
                                 if ("0".equals(tranSettlementReport.getManualFlag())) {
                                     //卸车不为空时,结算重量=装卸取小
                                     tranSettlementReport.setSettlementWeight(tranSettlementReport.getLoadingWeight() > tranSettlementReport.getUnloadingWeight() ? tranSettlementReport.getUnloadingWeight() : tranSettlementReport.getLoadingWeight());
@@ -1003,19 +1003,18 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                     tranSettlementReport.setDeductionAmount(0d);
                                 }
                                 if (tranSettlementReport.getTransportPrice()!=null) {
-                                    if (tranSettlementReport.getLossWeight() <= (tranSettlementReport.getLoadingWeight() / 1000)) {
+                                    //按吨计费
+                                    if("1".equals(tranSettlementReport.getBillingMethod())) {
                                         //应付=单价x结算重量
                                         tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
-                                        //实付金额
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - tranSettlementReport.getServiceCharge());
-                                    } else {
-                                        //应付=单价x结算重量-扣款
-                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())));
-                                        //实付金额
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
                                     }
+                                    //按车
+                                    else{
+                                        //应付
+                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                    }
+                                    //实付金额=应付-扣款-服务费
+                                    tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
                                     //税点
                                     tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
                                     //合计应付
@@ -1102,44 +1101,120 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         }
                         //退库派车情况
                         if (warehouseInOutInfo.getCarId()!=null) {
-                            //生成汽运报表
-                            TranSettlementReport tranSettlementReport = new TranSettlementReport();
-                            tranSettlementReport.setCompId(warehouseBaseInfo.getCompId());
-                            tranSettlementReport.setCarId(warehouseInOutInfo.getCarId());
-                            tranSettlementReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
-                            tranSettlementReport.setId(IdGenerator.generateUUID());
-                            tranSettlementReport.setTranType("汽运");
-                            tranSettlementReport.setTranTypeKey("1");
-                            tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setServiceCharge(20d);
-                            TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
-                            if (tranCarInfo != null) {
-                                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
-                                tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
-                                TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
-                                //运输单价不为空
-                                if (tranCarInfo.getTranPrice() != null) {
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid() / 0.946 * 0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid() + tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                            //退库入库时更新汽运报表卸车数据
+                            TranSettlementReport tranSettlementReport = tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
+                                    .eq("car_id", warehouseInOutInfo.getCarId()));
+                            if (tranSettlementReport!=null) {
+                                tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                //损耗
+                                tranSettlementReport.setLossWeight(tranSettlementReport.getLoadingWeight() - tranSettlementReport.getUnloadingWeight());
+                                //汽运类型
+                                if (tranSettlementReport.getTranTypeKey().equals(NumberConstant.CONSTANT1)) {
+                                    //结算重量
+                                    if ("0".equals(tranSettlementReport.getManualFlag())) {
+                                        //卸车不为空时,结算重量=装卸取小
+                                        tranSettlementReport.setSettlementWeight(tranSettlementReport.getLoadingWeight() > tranSettlementReport.getUnloadingWeight() ? tranSettlementReport.getUnloadingWeight() : tranSettlementReport.getLoadingWeight());
+                                        tranSettlementReport.setTransportDamage(tranSettlementReport.getSettlementWeight()*0.001);
+                                    }
+                                    if(tranSettlementReport.getLossWeight()<0){
+                                        tranSettlementReport.setActualLoss(0d);
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    //损耗大于结算重量的1‰时
+                                    else if (tranSettlementReport.getLossWeight()>tranSettlementReport.getSettlementWeight()*0.001){
+                                        //货损=损耗-结算重量x1‰
+                                        tranSettlementReport.setCargoDamage(tranSettlementReport.getLossWeight()-tranSettlementReport.getSettlementWeight()*0.001);
+                                        //实际损耗默认为结算重量的1‰
+                                        tranSettlementReport.setActualLoss(tranSettlementReport.getSettlementWeight()*0.001);
+                                        if (tranSettlementReport.getGrainPrice()!=null){
+                                            tranSettlementReport.setDeductionAmount(tranSettlementReport.getCargoDamage()*tranSettlementReport.getGrainPrice());
+                                        }
+                                        else{
+                                            tranSettlementReport.setDeductionAmount(0d);
+                                        }
+                                    }
+                                    //0<损耗<=结算重量的1‰时
+                                    else if(tranSettlementReport.getLossWeight()>0&&tranSettlementReport.getLossWeight()<=tranSettlementReport.getSettlementWeight()*0.001){
+                                        //实际损耗默认为损耗
+                                        tranSettlementReport.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport.getLossWeight())));
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    if (tranSettlementReport.getTransportPrice()!=null) {
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
+                                    }
                                 }
+                                tranSettlementReportService.updateById(tranSettlementReport);
+                            }
+                            else {
+                                //生成汽运报表
+                                TranSettlementReport tranSettlementReport1 = new TranSettlementReport();
+                                tranSettlementReport1.setCompId(warehouseBaseInfo.getCompId());
+                                tranSettlementReport1.setCarId(warehouseInOutInfo.getCarId());
+                                tranSettlementReport1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
+                                tranSettlementReport1.setId(IdGenerator.generateUUID());
+                                tranSettlementReport1.setTranType("汽运");
+                                tranSettlementReport1.setTranTypeKey("1");
+                                tranSettlementReport1.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setServiceCharge(20d);
+                                TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
+                                if (tranCarInfo != null) {
+                                    TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
+                                    tranSettlementReport1.setTaskNo(tranTaskInfo.getTaskNo());
+                                    tranSettlementReport1.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
+                                    tranSettlementReport1.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                    tranSettlementReport1.setBillingMethod(tranCarInfo.getBillingMethod());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice() != null) {
+                                        tranSettlementReport1.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport1.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                                        }
+                                        //实付=应付-服务费
+                                        tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                                                - tranSettlementReport1.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
+                                        //合计应付=实付+税点
+                                        tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid() + tranSettlementReport1.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
+                                    }
+                                }
+                                tranSettlementReport1.setContractNo(warehouseInOutInfo.getContractNo());
+                                tranSettlementReport1.setCarNo(warehouseInOutInfo.getCarNo());
+                                tranSettlementReport1.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                tranSettlementReport1.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
+                                tranSettlementReport1.setStatus(StatusEnum.PENDING_PAY.getName());
+                                tranSettlementReportService.insert(tranSettlementReport1);
                             }
-                            tranSettlementReport.setContractNo(warehouseInOutInfo.getContractNo());
-                            tranSettlementReport.setCarNo(warehouseInOutInfo.getCarNo());
-                            tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
-                            tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
-                            tranSettlementReport.setStatus(StatusEnum.PENDING_PAY.getName());
-                            tranSettlementReportService.insert(tranSettlementReport);
                         }
                     }
                     Wrapper wrapper = new EntityWrapper<TranCarInfo>()
@@ -1296,44 +1371,120 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                     if ("退库".equals(warehouseInOutInfo.getInOutType())){
                         //退库派车情况
                         if (warehouseInOutInfo.getCarId()!=null) {
-                            //生成汽运报表
-                            TranSettlementReport tranSettlementReport = new TranSettlementReport();
-                            tranSettlementReport.setCompId(warehouseBaseInfo.getCompId());
-                            tranSettlementReport.setCarId(warehouseInOutInfo.getCarId());
-                            tranSettlementReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
-                            tranSettlementReport.setId(IdGenerator.generateUUID());
-                            tranSettlementReport.setTranType("汽运");
-                            tranSettlementReport.setTranTypeKey("1");
-                            tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setServiceCharge(20d);
-                            TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
-                            if (tranCarInfo != null) {
-                                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
-                                tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
-                                TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
-                                //运输单价不为空
-                                if (tranCarInfo.getTranPrice() != null) {
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid() / 0.946 * 0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid() + tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                            //退库入库时更新汽运报表卸车数据
+                            TranSettlementReport tranSettlementReport = tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
+                                    .eq("car_id", warehouseInOutInfo.getCarId()));
+                            if (tranSettlementReport!=null) {
+                                tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                //损耗
+                                tranSettlementReport.setLossWeight(tranSettlementReport.getLoadingWeight() - tranSettlementReport.getUnloadingWeight());
+                                //汽运类型
+                                if (tranSettlementReport.getTranTypeKey().equals(NumberConstant.CONSTANT1)) {
+                                    //结算重量
+                                    if ("0".equals(tranSettlementReport.getManualFlag())) {
+                                        //卸车不为空时,结算重量=装卸取小
+                                        tranSettlementReport.setSettlementWeight(tranSettlementReport.getLoadingWeight() > tranSettlementReport.getUnloadingWeight() ? tranSettlementReport.getUnloadingWeight() : tranSettlementReport.getLoadingWeight());
+                                        tranSettlementReport.setTransportDamage(tranSettlementReport.getSettlementWeight()*0.001);
+                                    }
+                                    if(tranSettlementReport.getLossWeight()<0){
+                                        tranSettlementReport.setActualLoss(0d);
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    //损耗大于结算重量的1‰时
+                                    else if (tranSettlementReport.getLossWeight()>tranSettlementReport.getSettlementWeight()*0.001){
+                                        //货损=损耗-结算重量x1‰
+                                        tranSettlementReport.setCargoDamage(tranSettlementReport.getLossWeight()-tranSettlementReport.getSettlementWeight()*0.001);
+                                        //实际损耗默认为结算重量的1‰
+                                        tranSettlementReport.setActualLoss(tranSettlementReport.getSettlementWeight()*0.001);
+                                        if (tranSettlementReport.getGrainPrice()!=null){
+                                            tranSettlementReport.setDeductionAmount(tranSettlementReport.getCargoDamage()*tranSettlementReport.getGrainPrice());
+                                        }
+                                        else{
+                                            tranSettlementReport.setDeductionAmount(0d);
+                                        }
+                                    }
+                                    //0<损耗<=结算重量的1‰时
+                                    else if(tranSettlementReport.getLossWeight()>0&&tranSettlementReport.getLossWeight()<=tranSettlementReport.getSettlementWeight()*0.001){
+                                        //实际损耗默认为损耗
+                                        tranSettlementReport.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport.getLossWeight())));
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    if (tranSettlementReport.getTransportPrice()!=null) {
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
+                                    }
                                 }
+                                tranSettlementReportService.updateById(tranSettlementReport);
+                            }
+                            else {
+                                //生成汽运报表
+                                TranSettlementReport tranSettlementReport1 = new TranSettlementReport();
+                                tranSettlementReport1.setCompId(warehouseBaseInfo.getCompId());
+                                tranSettlementReport1.setCarId(warehouseInOutInfo.getCarId());
+                                tranSettlementReport1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
+                                tranSettlementReport1.setId(IdGenerator.generateUUID());
+                                tranSettlementReport1.setTranType("汽运");
+                                tranSettlementReport1.setTranTypeKey("1");
+                                tranSettlementReport1.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setServiceCharge(20d);
+                                TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
+                                if (tranCarInfo != null) {
+                                    TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
+                                    tranSettlementReport1.setTaskNo(tranTaskInfo.getTaskNo());
+                                    tranSettlementReport1.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    tranSettlementReport1.setBillingMethod(tranCarInfo.getBillingMethod());
+                                    TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
+                                    tranSettlementReport1.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice() != null) {
+                                        tranSettlementReport1.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport1.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                                        }
+                                        //实付=应付-服务费
+                                        tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                                                - tranSettlementReport1.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
+                                        //合计应付=实付+税点
+                                        tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid() + tranSettlementReport1.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
+                                    }
+                                }
+                                tranSettlementReport1.setContractNo(warehouseInOutInfo.getContractNo());
+                                tranSettlementReport1.setCarNo(warehouseInOutInfo.getCarNo());
+                                tranSettlementReport1.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                tranSettlementReport1.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
+                                tranSettlementReport1.setStatus(StatusEnum.PENDING_PAY.getName());
+                                tranSettlementReportService.insert(tranSettlementReport1);
                             }
-                            tranSettlementReport.setContractNo(warehouseInOutInfo.getContractNo());
-                            tranSettlementReport.setCarNo(warehouseInOutInfo.getCarNo());
-                            tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
-                            tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
-                            tranSettlementReport.setStatus(StatusEnum.PENDING_PAY.getName());
-                            tranSettlementReportService.insert(tranSettlementReport);
                         }
                     }
                     //更新库存量
@@ -1616,26 +1767,38 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                         tranSettlementReport.setTranTypeKey("1");
                                         tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                         tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                        tranSettlementReport.setBillingMethod(tranProcessInfo.getBillingMethod());
                                         tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
                                         tranSettlementReport.setServiceCharge(20d);
                                         //运输单价不为空
                                         if (tranProcessInfo.getTranPrice()!=null){
-                                            //实付金额
+                                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
+                                            tranSettlementReport.setSettlementPrice(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())));
+                                            //按吨计费
+                                            if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                                //应付=单价x结算重量
+                                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                            }
+                                            //按车
+                                            else{
+                                                //应付
+                                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                            }
+                                            //扣款
                                             if(tranSettlementReport.getDeductionAmount() != null){
-                                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranProcessInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
+                                                //实付金额=应付-扣款-服务费
+                                                tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
                                                         - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
                                             }else{
-                                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranProcessInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
+                                                tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
                                                         - tranSettlementReport.getServiceCharge());
                                             }
                                             //税点
                                             tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                            //合计应付
+                                            //合计应付=实付+税点
                                             tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
                                             //未付
                                             tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
-                                            tranSettlementReport.setSettlementPrice(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())));
                                         }
                                     } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                                         tranSettlementReport.setTranType("火运");
@@ -1817,29 +1980,41 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                     TranTaskInfo tranTaskInfo=tranTaskInfoService.selectById(tranCarInfo.getInfoId());
                                     tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                     tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                                     TranProcessInfo tranProcessInfo=tranProcessInfoService.selectById(tranCarInfo.getProcessId());
                                     if (tranProcessInfo!=null){
+                                        //货值
                                         tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                     }
-                                }
-                                //运输单价不为空
-                                if (tranCarInfo!=null&&tranCarInfo.getTranPrice()!=null){
-                                    //实付金额
-                                    if(tranSettlementReport.getDeductionAmount() != null){
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
-                                    }else{
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - tranSettlementReport.getServiceCharge());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice()!=null){
+                                        tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额
+                                        if(tranSettlementReport.getDeductionAmount() != null){
+                                            tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                    - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
+                                        }else{
+                                            tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                    - tranSettlementReport.getServiceCharge());
+                                        }
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                                     }
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
                                 }
                             } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                                 tranSettlementReport.setTranType("火运");
@@ -2380,29 +2555,40 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                 TranTaskInfo tranTaskInfo=tranTaskInfoService.selectById(tranCarInfo.getInfoId());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                 tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                                 TranProcessInfo tranProcessInfo=tranProcessInfoService.selectById(tranCarInfo.getProcessId());
                                 if (tranProcessInfo!=null){
                                     tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                 }
-                            }
-                            //运输单价不为空
-                            if (tranCarInfo!=null&&tranCarInfo.getTranPrice()!=null){
-                                //实付金额
-                                if(tranSettlementReport.getDeductionAmount() != null){
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
-                                }else{
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
+                                //运输单价不为空
+                                if (tranCarInfo.getTranPrice()!=null){
+                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                    //按吨计费
+                                    if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                        //应付=单价x结算重量
+                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                    }
+                                    //按车
+                                    else{
+                                        //应付
+                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                    }
+                                    //实付金额
+                                    if(tranSettlementReport.getDeductionAmount() != null){
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
+                                    }else{
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                - tranSettlementReport.getServiceCharge());
+                                    }
+                                    //税点
+                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                    //合计应付
+                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                    //未付
+                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                                 }
-                                //税点
-                                tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                //合计应付
-                                tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
-                                //未付
-                                tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
                             }
                         } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                             tranSettlementReport.setTranType("火运");
@@ -3995,19 +4181,18 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                         tranSettlementReport.setDeductionAmount(0d);
                                     }
                                     if (tranSettlementReport.getTransportPrice() != null) {
-                                        if (tranSettlementReport.getLossWeight() <= (tranSettlementReport.getLoadingWeight() / 1000)) {
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
                                             //应付=单价x结算重量
                                             tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
-                                            //实付金额
-                                            tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * tranSettlementReport.getSettlementWeight()
-                                                    - tranSettlementReport.getServiceCharge());
-                                        } else {
-                                            //应付=单价x结算重量-扣款
-                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())));
-                                            //实付金额
-                                            tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranSettlementReport.getTransportPrice()) * tranSettlementReport.getSettlementWeight()
-                                                    - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
                                         }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
                                         //税点
                                         tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
                                         //合计应付
@@ -4101,44 +4286,120 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                         }
                         //退库派车情况
                         if (warehouseInOutInfo.getCarId()!=null) {
-                            //生成汽运报表
-                            TranSettlementReport tranSettlementReport = new TranSettlementReport();
-                            tranSettlementReport.setCompId(warehouseBaseInfo.getCompId());
-                            tranSettlementReport.setCarId(warehouseInOutInfo.getCarId());
-                            tranSettlementReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
-                            tranSettlementReport.setId(IdGenerator.generateUUID());
-                            tranSettlementReport.setTranType("汽运");
-                            tranSettlementReport.setTranTypeKey("1");
-                            tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setServiceCharge(20d);
-                            TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
-                            if (tranCarInfo != null) {
-                                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
-                                tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
-                                TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
-                                //运输单价不为空
-                                if (tranCarInfo.getTranPrice() != null) {
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid() / 0.946 * 0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid() + tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                            //退库入库时更新汽运报表卸车数据
+                            TranSettlementReport tranSettlementReport = tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
+                                    .eq("car_id", warehouseInOutInfo.getCarId()));
+                            if (tranSettlementReport!=null) {
+                                tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                //损耗
+                                tranSettlementReport.setLossWeight(tranSettlementReport.getLoadingWeight() - tranSettlementReport.getUnloadingWeight());
+                                //汽运类型
+                                if (tranSettlementReport.getTranTypeKey().equals(NumberConstant.CONSTANT1)) {
+                                    //结算重量
+                                    if ("0".equals(tranSettlementReport.getManualFlag())) {
+                                        //卸车不为空时,结算重量=装卸取小
+                                        tranSettlementReport.setSettlementWeight(tranSettlementReport.getLoadingWeight() > tranSettlementReport.getUnloadingWeight() ? tranSettlementReport.getUnloadingWeight() : tranSettlementReport.getLoadingWeight());
+                                        tranSettlementReport.setTransportDamage(tranSettlementReport.getSettlementWeight()*0.001);
+                                    }
+                                    if(tranSettlementReport.getLossWeight()<0){
+                                        tranSettlementReport.setActualLoss(0d);
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    //损耗大于结算重量的1‰时
+                                    else if (tranSettlementReport.getLossWeight()>tranSettlementReport.getSettlementWeight()*0.001){
+                                        //货损=损耗-结算重量x1‰
+                                        tranSettlementReport.setCargoDamage(tranSettlementReport.getLossWeight()-tranSettlementReport.getSettlementWeight()*0.001);
+                                        //实际损耗默认为结算重量的1‰
+                                        tranSettlementReport.setActualLoss(tranSettlementReport.getSettlementWeight()*0.001);
+                                        if (tranSettlementReport.getGrainPrice()!=null){
+                                            tranSettlementReport.setDeductionAmount(tranSettlementReport.getCargoDamage()*tranSettlementReport.getGrainPrice());
+                                        }
+                                        else{
+                                            tranSettlementReport.setDeductionAmount(0d);
+                                        }
+                                    }
+                                    //0<损耗<=结算重量的1‰时
+                                    else if(tranSettlementReport.getLossWeight()>0&&tranSettlementReport.getLossWeight()<=tranSettlementReport.getSettlementWeight()*0.001){
+                                        //实际损耗默认为损耗
+                                        tranSettlementReport.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport.getLossWeight())));
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    if (tranSettlementReport.getTransportPrice()!=null) {
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
+                                    }
                                 }
+                                tranSettlementReportService.updateById(tranSettlementReport);
+                            }
+                            else {
+                                //生成汽运报表
+                                TranSettlementReport tranSettlementReport1 = new TranSettlementReport();
+                                tranSettlementReport1.setCompId(warehouseBaseInfo.getCompId());
+                                tranSettlementReport1.setCarId(warehouseInOutInfo.getCarId());
+                                tranSettlementReport1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
+                                tranSettlementReport1.setId(IdGenerator.generateUUID());
+                                tranSettlementReport1.setTranType("汽运");
+                                tranSettlementReport1.setTranTypeKey("1");
+                                tranSettlementReport1.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setServiceCharge(20d);
+                                TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
+                                if (tranCarInfo != null) {
+                                    TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
+                                    tranSettlementReport1.setTaskNo(tranTaskInfo.getTaskNo());
+                                    tranSettlementReport1.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
+                                    tranSettlementReport1.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                    tranSettlementReport1.setBillingMethod(tranCarInfo.getBillingMethod());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice() != null) {
+                                        tranSettlementReport1.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport1.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                                        }
+                                        //实付=应付-服务费
+                                        tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                                                - tranSettlementReport1.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
+                                        //合计应付
+                                        tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid() + tranSettlementReport1.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
+                                    }
+                                }
+                                tranSettlementReport1.setContractNo(warehouseInOutInfo.getContractNo());
+                                tranSettlementReport1.setCarNo(warehouseInOutInfo.getCarNo());
+                                tranSettlementReport1.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                tranSettlementReport1.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
+                                tranSettlementReport1.setStatus(StatusEnum.PENDING_PAY.getName());
+                                tranSettlementReportService.insert(tranSettlementReport1);
                             }
-                            tranSettlementReport.setContractNo(warehouseInOutInfo.getContractNo());
-                            tranSettlementReport.setCarNo(warehouseInOutInfo.getCarNo());
-                            tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
-                            tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
-                            tranSettlementReport.setStatus(StatusEnum.PENDING_PAY.getName());
-                            tranSettlementReportService.insert(tranSettlementReport);
                         }
                     }
                     if (warehouseInOutInfo.getWeighingManagement() != null) {
@@ -4378,44 +4639,120 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                     if ("退库".equals(warehouseInOutInfo.getInOutType())){
                         //退库派车情况
                         if (warehouseInOutInfo.getCarId()!=null) {
-                            //生成汽运报表
-                            TranSettlementReport tranSettlementReport = new TranSettlementReport();
-                            tranSettlementReport.setCompId(warehouseBaseInfo.getCompId());
-                            tranSettlementReport.setCarId(warehouseInOutInfo.getCarId());
-                            tranSettlementReport.setTranCarNo(warehouseInOutInfo.getTranCarNo());
-                            tranSettlementReport.setId(IdGenerator.generateUUID());
-                            tranSettlementReport.setTranType("汽运");
-                            tranSettlementReport.setTranTypeKey("1");
-                            tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setServiceCharge(20d);
-                            TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
-                            if (tranCarInfo != null) {
-                                TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
-                                tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
-                                tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
-                                TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
-                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
-                                //运输单价不为空
-                                if (tranCarInfo.getTranPrice() != null) {
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid() / 0.946 * 0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid() + tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                            //退库入库时更新汽运报表卸车数据
+                            TranSettlementReport tranSettlementReport = tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
+                                    .eq("car_id", warehouseInOutInfo.getCarId()));
+                            if (tranSettlementReport!=null) {
+                                tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                //损耗
+                                tranSettlementReport.setLossWeight(tranSettlementReport.getLoadingWeight() - tranSettlementReport.getUnloadingWeight());
+                                //汽运类型
+                                if (tranSettlementReport.getTranTypeKey().equals(NumberConstant.CONSTANT1)) {
+                                    //结算重量
+                                    if ("0".equals(tranSettlementReport.getManualFlag())) {
+                                        //卸车不为空时,结算重量=装卸取小
+                                        tranSettlementReport.setSettlementWeight(tranSettlementReport.getLoadingWeight() > tranSettlementReport.getUnloadingWeight() ? tranSettlementReport.getUnloadingWeight() : tranSettlementReport.getLoadingWeight());
+                                        tranSettlementReport.setTransportDamage(tranSettlementReport.getSettlementWeight()*0.001);
+                                    }
+                                    if(tranSettlementReport.getLossWeight()<0){
+                                        tranSettlementReport.setActualLoss(0d);
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    //损耗大于结算重量的1‰时
+                                    else if (tranSettlementReport.getLossWeight()>tranSettlementReport.getSettlementWeight()*0.001){
+                                        //货损=损耗-结算重量x1‰
+                                        tranSettlementReport.setCargoDamage(tranSettlementReport.getLossWeight()-tranSettlementReport.getSettlementWeight()*0.001);
+                                        //实际损耗默认为结算重量的1‰
+                                        tranSettlementReport.setActualLoss(tranSettlementReport.getSettlementWeight()*0.001);
+                                        if (tranSettlementReport.getGrainPrice()!=null){
+                                            tranSettlementReport.setDeductionAmount(tranSettlementReport.getCargoDamage()*tranSettlementReport.getGrainPrice());
+                                        }
+                                        else{
+                                            tranSettlementReport.setDeductionAmount(0d);
+                                        }
+                                    }
+                                    //0<损耗<=结算重量的1‰时
+                                    else if(tranSettlementReport.getLossWeight()>0&&tranSettlementReport.getLossWeight()<=tranSettlementReport.getSettlementWeight()*0.001){
+                                        //实际损耗默认为损耗
+                                        tranSettlementReport.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport.getLossWeight())));
+                                        tranSettlementReport.setDeductionAmount(0d);
+                                    }
+                                    if (tranSettlementReport.getTransportPrice()!=null) {
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额=应付-扣款-服务费
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable() - Float.valueOf(String.valueOf(tranSettlementReport.getDeductionAmount())) - tranSettlementReport.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
+                                    }
                                 }
+                                tranSettlementReportService.updateById(tranSettlementReport);
+                            }
+                            else {
+                                //生成汽运报表
+                                TranSettlementReport tranSettlementReport1 = new TranSettlementReport();
+                                tranSettlementReport1.setCompId(warehouseBaseInfo.getCompId());
+                                tranSettlementReport1.setCarId(warehouseInOutInfo.getCarId());
+                                tranSettlementReport1.setTranCarNo(warehouseInOutInfo.getTranCarNo());
+                                tranSettlementReport1.setId(IdGenerator.generateUUID());
+                                tranSettlementReport1.setTranType("汽运");
+                                tranSettlementReport1.setTranTypeKey("1");
+                                tranSettlementReport1.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setServiceCharge(20d);
+                                TranCarInfo tranCarInfo = tranCarInfoService.selectById(warehouseInOutInfo.getCarId());
+                                if (tranCarInfo != null) {
+                                    TranTaskInfo tranTaskInfo = tranTaskInfoService.selectById(tranCarInfo.getInfoId());
+                                    tranSettlementReport1.setTaskNo(tranTaskInfo.getTaskNo());
+                                    tranSettlementReport1.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    tranSettlementReport1.setBillingMethod(tranCarInfo.getBillingMethod());
+                                    TranProcessInfo tranProcessInfo = tranProcessInfoService.selectById(tranCarInfo.getProcessId());
+                                    tranSettlementReport1.setGrainPrice(tranProcessInfo.getGoodsValue());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice() != null) {
+                                        tranSettlementReport1.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport1.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport1.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice() * tranSettlementReport1.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport1.setAmountIngPayable(tranSettlementReport1.getTransportPrice());
+                                        }
+                                        //实付=应付-服务费
+                                        tranSettlementReport1.setAmountActuallyPaid(tranSettlementReport1.getAmountIngPayable()
+                                                - tranSettlementReport1.getServiceCharge());
+                                        //税点
+                                        tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
+                                        //合计应付
+                                        tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid() + tranSettlementReport1.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
+                                    }
+                                }
+                                tranSettlementReport1.setContractNo(warehouseInOutInfo.getContractNo());
+                                tranSettlementReport1.setCarNo(warehouseInOutInfo.getCarNo());
+                                tranSettlementReport1.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
+                                tranSettlementReport1.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
+                                tranSettlementReport1.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
+                                tranSettlementReport1.setStatus(StatusEnum.PENDING_PAY.getName());
+                                tranSettlementReportService.insert(tranSettlementReport1);
                             }
-                            tranSettlementReport.setContractNo(warehouseInOutInfo.getContractNo());
-                            tranSettlementReport.setCarNo(warehouseInOutInfo.getCarNo());
-                            tranSettlementReport.setUnloadingImg(warehouseInOutInfo.getAddressUrl());
-                            tranSettlementReport.setUnloadingWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
-                            tranSettlementReport.setStatusFlag(StatusEnum.PENDING_PAY.getFlag());
-                            tranSettlementReport.setStatus(StatusEnum.PENDING_PAY.getName());
-                            tranSettlementReportService.insert(tranSettlementReport);
                         }
                     }
                     //更新库存量
@@ -4721,16 +5058,29 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                         tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
                                         tranSettlementReport.setTranType("汽运");
                                         tranSettlementReport.setTranTypeKey("1");
+                                        tranSettlementReport.setBillingMethod(tranProcessInfo.getBillingMethod());
                                         tranSettlementReport.setSettlementWeight(Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight())));
                                         tranSettlementReport.setServiceCharge(20d);
                                         //运输单价不为空
                                         if (tranProcessInfo.getTranPrice()!=null){
+                                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
+                                            tranSettlementReport.setSettlementPrice(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())));
+                                            //按吨计费
+                                            if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                                //应付=单价x结算重量
+                                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                            }
+                                            //按车
+                                            else{
+                                                //应付
+                                                tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                            }
                                             //实付金额
                                             if(tranSettlementReport.getDeductionAmount() != null){
-                                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())) * tranSettlementReport.getSettlementWeight()
+                                                tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
                                                         - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
                                             }else{
-                                                tranSettlementReport.setAmountActuallyPaid(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())) * tranSettlementReport.getSettlementWeight()
+                                                tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
                                                         - tranSettlementReport.getServiceCharge());
                                             }
                                             //税点
@@ -4739,8 +5089,6 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                             tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
                                             //未付
                                             tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                            tranSettlementReport.setTransportPrice(tranProcessInfo.getTranPrice());
-                                            tranSettlementReport.setSettlementPrice(Double.valueOf(String.valueOf(tranProcessInfo.getTranPrice())));
                                         }
                                     } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                                         tranSettlementReport.setTranType("火运");
@@ -4945,29 +5293,40 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                     TranTaskInfo tranTaskInfo=tranTaskInfoService.selectById(tranCarInfo.getInfoId());
                                     tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                     tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                    tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                                     TranProcessInfo tranProcessInfo=tranProcessInfoService.selectById(tranCarInfo.getProcessId());
                                     if (tranProcessInfo!=null){
                                         tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                     }
-                                }
-                                //运输单价不为空
-                                if (tranCarInfo!=null&&tranCarInfo.getTranPrice()!=null){
-                                    //实付金额
-                                    if(tranSettlementReport.getDeductionAmount() != null){
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
-                                    }else{
-                                        tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                                - tranSettlementReport.getServiceCharge());
+                                    //运输单价不为空
+                                    if (tranCarInfo.getTranPrice()!=null){
+                                        tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                        tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                        //按吨计费
+                                        if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                            //应付=单价x结算重量
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                        }
+                                        //按车
+                                        else{
+                                            //应付
+                                            tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                        }
+                                        //实付金额
+                                        if(tranSettlementReport.getDeductionAmount() != null){
+                                            tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                    - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
+                                        }else{
+                                            tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                    - tranSettlementReport.getServiceCharge());
+                                        }
+                                        //税点
+                                        tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                        //合计应付
+                                        tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                        //未付
+                                        tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                                     }
-                                    //税点
-                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                    //合计应付
-                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
-                                    //未付
-                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
                                 }
                             } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                                 tranSettlementReport.setTranType("火运");
@@ -5582,29 +5941,40 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                                 TranTaskInfo tranTaskInfo=tranTaskInfoService.selectById(tranCarInfo.getInfoId());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                 tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
+                                tranSettlementReport.setBillingMethod(tranCarInfo.getBillingMethod());
                                 TranProcessInfo tranProcessInfo=tranProcessInfoService.selectById(tranCarInfo.getProcessId());
                                 if (tranProcessInfo!=null){
                                     tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                 }
-                            }
-                            //运输单价不为空
-                            if (tranCarInfo!=null&&tranCarInfo.getTranPrice()!=null){
-                                //实付金额
-                                if(tranSettlementReport.getDeductionAmount() != null){
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
-                                }else{
-                                    tranSettlementReport.setAmountActuallyPaid(Double.valueOf(tranCarInfo.getTranPrice()) * tranSettlementReport.getSettlementWeight()
-                                            - tranSettlementReport.getServiceCharge());
+                                //运输单价不为空
+                                if (tranCarInfo.getTranPrice()!=null){
+                                    tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
+                                    tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
+                                    //按吨计费
+                                    if("1".equals(tranSettlementReport.getBillingMethod())) {
+                                        //应付=单价x结算重量
+                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice() * tranSettlementReport.getSettlementWeight());
+                                    }
+                                    //按车
+                                    else{
+                                        //应付
+                                        tranSettlementReport.setAmountIngPayable(tranSettlementReport.getTransportPrice());
+                                    }
+                                    //实付金额
+                                    if(tranSettlementReport.getDeductionAmount() != null){
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                - Double.valueOf(tranSettlementReport.getDeductionAmount()) - tranSettlementReport.getServiceCharge());
+                                    }else{
+                                        tranSettlementReport.setAmountActuallyPaid(tranSettlementReport.getAmountIngPayable()
+                                                - tranSettlementReport.getServiceCharge());
+                                    }
+                                    //税点
+                                    tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
+                                    //合计应付
+                                    tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
+                                    //未付
+                                    tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
                                 }
-                                //税点
-                                tranSettlementReport.setTaxPoint(tranSettlementReport.getAmountActuallyPaid()/0.946*0.054);
-                                //合计应付
-                                tranSettlementReport.setTotalPayable(tranSettlementReport.getAmountActuallyPaid()+tranSettlementReport.getTaxPoint());
-                                //未付
-                                tranSettlementReport.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport.getTotalPayable())));
-                                tranSettlementReport.setTransportPrice(Float.valueOf(tranCarInfo.getTranPrice()));
-                                tranSettlementReport.setSettlementPrice(Double.valueOf(tranCarInfo.getTranPrice()));
                             }
                         } else if ("火运".equals(warehouseInOutInfo.getOutType())) {
                             tranSettlementReport.setTranType("火运");

+ 1 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/TranSettlementReportMapper.xml

@@ -90,6 +90,7 @@
         box_no as boxNo,
         task_no as taskNo,
         ship_type as shipType,
+        billing_method as billingMethod,
         batch_id as batchId,
         phone,
         name as name,