|
@@ -345,6 +345,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
|
|
|
tranSettlementReport.setId(IdGenerator.generateUUID());
|
|
|
tranSettlementReport.setTranType("汽运");
|
|
|
tranSettlementReport.setTranTypeKey("1");
|
|
|
+ tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
|
|
|
tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
|
|
|
tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
|
|
|
ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
|
|
@@ -509,67 +510,69 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
|
|
|
TranSettlementReport tranSettlementReport1 = tranSettlementReportService.selectOne(new EntityWrapper<TranSettlementReport>()
|
|
|
.eq("car_id", tranCarInfo.getId()));
|
|
|
if (tranSettlementReport1!=null) {
|
|
|
- if (tranCarInfo.getUnloadNetWeight() > 0&&tranProcessInfo.getFlag()!=null) {
|
|
|
- tranSettlementReport1.setLoadingImg(tranCarInfo.getLoadPoundImg());
|
|
|
- tranSettlementReport1.setUnloadingWeight(tranCarInfo.getUnloadNetWeight());
|
|
|
- tranSettlementReport1.setUnloadingImg(tranCarInfo.getUnloadPoundImg());
|
|
|
- //损耗
|
|
|
- tranSettlementReport1.setLossWeight(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight());
|
|
|
- //汽运类型
|
|
|
- if (tranCarInfo.getTranType().equals(NumberConstant.CONSTANT1)) {
|
|
|
- //结算重量
|
|
|
- if ("0".equals(tranSettlementReport1.getManualFlag())) {
|
|
|
- //卸车不为空时,结算重量=装卸取小
|
|
|
- tranSettlementReport1.setSettlementWeight(tranCarInfo.getLoadNetWeight() > tranCarInfo.getUnloadNetWeight() ? tranCarInfo.getUnloadNetWeight() : tranCarInfo.getLoadNetWeight());
|
|
|
- tranSettlementReport1.setTransportDamage(tranSettlementReport1.getSettlementWeight()*0.001);
|
|
|
- }
|
|
|
- if(tranSettlementReport1.getLossWeight()<0){
|
|
|
- tranSettlementReport1.setActualLoss(0d);
|
|
|
- tranSettlementReport1.setDeductionAmount(0d);
|
|
|
- }
|
|
|
- //损耗大于结算重量的1‰时
|
|
|
- else if (tranSettlementReport1.getLossWeight()>tranSettlementReport1.getSettlementWeight()*0.001){
|
|
|
- //货损=损耗-结算重量x1‰
|
|
|
- tranSettlementReport1.setCargoDamage(tranSettlementReport1.getLossWeight()-tranSettlementReport1.getSettlementWeight()*0.001);
|
|
|
- //实际损耗默认为结算重量的1‰
|
|
|
- tranSettlementReport1.setActualLoss(tranSettlementReport1.getSettlementWeight()*0.001);
|
|
|
- if (tranSettlementReport1.getGrainPrice()!=null){
|
|
|
- tranSettlementReport1.setDeductionAmount(tranSettlementReport1.getCargoDamage()*tranSettlementReport1.getGrainPrice());
|
|
|
+ //已卸车过的不重复更新
|
|
|
+ if (tranSettlementReport1.getUnloadingWeight()==null) {
|
|
|
+ if (tranCarInfo.getUnloadNetWeight() > 0 && tranProcessInfo.getFlag() != null) {
|
|
|
+ tranSettlementReport1.setLoadingImg(tranCarInfo.getLoadPoundImg());
|
|
|
+ tranSettlementReport1.setUnloadingWeight(tranCarInfo.getUnloadNetWeight());
|
|
|
+ tranSettlementReport1.setUnloadingImg(tranCarInfo.getUnloadPoundImg());
|
|
|
+ //损耗
|
|
|
+ tranSettlementReport1.setLossWeight(tranCarInfo.getLoadNetWeight() - tranCarInfo.getUnloadNetWeight());
|
|
|
+ //汽运类型
|
|
|
+ if (tranCarInfo.getTranType().equals(NumberConstant.CONSTANT1)) {
|
|
|
+ //结算重量
|
|
|
+ if ("0".equals(tranSettlementReport1.getManualFlag())) {
|
|
|
+ //卸车不为空时,结算重量=装卸取小
|
|
|
+ tranSettlementReport1.setSettlementWeight(tranCarInfo.getLoadNetWeight() > tranCarInfo.getUnloadNetWeight() ? tranCarInfo.getUnloadNetWeight() : tranCarInfo.getLoadNetWeight());
|
|
|
+ tranSettlementReport1.setTransportDamage(tranSettlementReport1.getSettlementWeight() * 0.001);
|
|
|
}
|
|
|
- else{
|
|
|
+ if (tranSettlementReport1.getLossWeight() < 0) {
|
|
|
+ tranSettlementReport1.setActualLoss(0d);
|
|
|
tranSettlementReport1.setDeductionAmount(0d);
|
|
|
}
|
|
|
+ //损耗大于结算重量的1‰时
|
|
|
+ else if (tranSettlementReport1.getLossWeight() > tranSettlementReport1.getSettlementWeight() * 0.001) {
|
|
|
+ //货损=损耗-结算重量x1‰
|
|
|
+ tranSettlementReport1.setCargoDamage(tranSettlementReport1.getLossWeight() - tranSettlementReport1.getSettlementWeight() * 0.001);
|
|
|
+ //实际损耗默认为结算重量的1‰
|
|
|
+ tranSettlementReport1.setActualLoss(tranSettlementReport1.getSettlementWeight() * 0.001);
|
|
|
+ if (tranSettlementReport1.getGrainPrice() != null) {
|
|
|
+ tranSettlementReport1.setDeductionAmount(tranSettlementReport1.getCargoDamage() * tranSettlementReport1.getGrainPrice());
|
|
|
+ } else {
|
|
|
+ tranSettlementReport1.setDeductionAmount(0d);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //0<损耗<结算重量的1‰时
|
|
|
+ else if (tranSettlementReport1.getLossWeight() > 0 && tranSettlementReport1.getLossWeight() < tranSettlementReport1.getSettlementWeight() * 0.001) {
|
|
|
+ //实际损耗默认为损耗
|
|
|
+ tranSettlementReport1.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport1.getLossWeight())));
|
|
|
+ tranSettlementReport1.setDeductionAmount(0d);
|
|
|
+ }
|
|
|
+ //扣款
|
|
|
+ if (tranSettlementReport1.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
|
|
|
+ //应付=单价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());
|
|
|
+ }
|
|
|
+ //税点
|
|
|
+ tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid() / 0.946 * 0.054);
|
|
|
+ //合计应付
|
|
|
+ tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid() + tranSettlementReport1.getTaxPoint());
|
|
|
+ //未付
|
|
|
+ tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
|
|
|
}
|
|
|
- //0<损耗<结算重量的1‰时
|
|
|
- else if(tranSettlementReport1.getLossWeight()>0&&tranSettlementReport1.getLossWeight()<tranSettlementReport1.getSettlementWeight()*0.001){
|
|
|
- //实际损耗默认为损耗
|
|
|
- tranSettlementReport1.setActualLoss(Double.valueOf(String.valueOf(tranSettlementReport1.getLossWeight())));
|
|
|
- tranSettlementReport1.setDeductionAmount(0d);
|
|
|
- }
|
|
|
- //扣款
|
|
|
- if (tranSettlementReport1.getLossWeight() <= (tranCarInfo.getLoadNetWeight() / 1000)) {
|
|
|
- //应付=单价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());
|
|
|
- }
|
|
|
- //税点
|
|
|
- tranSettlementReport1.setTaxPoint(tranSettlementReport1.getAmountActuallyPaid()/0.946*0.054);
|
|
|
- //合计应付
|
|
|
- tranSettlementReport1.setTotalPayable(tranSettlementReport1.getAmountActuallyPaid()+tranSettlementReport1.getTaxPoint());
|
|
|
- //未付
|
|
|
- tranSettlementReport1.setAmountNotPayable(Float.valueOf(String.valueOf(tranSettlementReport1.getTotalPayable())));
|
|
|
- }
|
|
|
- tranSettlementReportService.updateById(tranSettlementReport1);
|
|
|
+ tranSettlementReportService.updateById(tranSettlementReport1);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
else {
|
|
|
TranSettlementReport tranSettlementReport=new TranSettlementReport();
|
|
|
//生成汽运报表
|