|
@@ -63,6 +63,8 @@ public class BiInfoController {
|
|
private IWeighingManagementService weighingManagementService;
|
|
private IWeighingManagementService weighingManagementService;
|
|
@Autowired
|
|
@Autowired
|
|
private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
private IStockSaleReceiptReportService stockSaleReceiptReportService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IStockPurchaseReceiptReportService stockPurchaseReceiptReportService;
|
|
private String companyId;
|
|
private String companyId;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -325,9 +327,9 @@ public class BiInfoController {
|
|
*/
|
|
*/
|
|
private List<BiViewInfo> getBuyInfo(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos) {
|
|
private List<BiViewInfo> getBuyInfo(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos) {
|
|
// 采购合同总量
|
|
// 采购合同总量
|
|
- Float sumTotal = 0f;
|
|
|
|
|
|
+ Double sumTotal = 0d;
|
|
// 采购合同完成量
|
|
// 采购合同完成量
|
|
- Float completedQuantity = 0f;
|
|
|
|
|
|
+ Double completedQuantity = 0d;
|
|
// 采购合同总金额
|
|
// 采购合同总金额
|
|
Double moneyTotal = 0.00;
|
|
Double moneyTotal = 0.00;
|
|
//采购合同已开发票金额
|
|
//采购合同已开发票金额
|
|
@@ -335,28 +337,30 @@ public class BiInfoController {
|
|
// 采购合同已回款金额
|
|
// 采购合同已回款金额
|
|
Double payTotal = 0.00;
|
|
Double payTotal = 0.00;
|
|
for (int i = 0; i < contractManagementInfos.size(); i++) {
|
|
for (int i = 0; i < contractManagementInfos.size(); i++) {
|
|
- ContractManagementInfo contractManagementInfo = contractManagementInfos.get(i);
|
|
|
|
- sumTotal = sumTotal + contractManagementInfo.getWeight();
|
|
|
|
- moneyTotal = moneyTotal + contractManagementInfo.getTotalContractPrice();
|
|
|
|
- if ("1".equals(contractManagementInfo.getGoodsType()) && "1".equals(contractManagementInfo.getDeliverType()) && "2".equals(contractManagementInfo.getContractType())) {
|
|
|
|
|
|
+ ContractManagementInfo contractManagementInfo1 = contractManagementInfos.get(i);
|
|
|
|
+ sumTotal = sumTotal + contractManagementInfo1.getWeight();
|
|
|
|
+// moneyTotal = moneyTotal + contractManagementInfo1.getTotalContractPrice();
|
|
|
|
+
|
|
|
|
+ //现货自运采购合同
|
|
|
|
+ if ("1".equals(contractManagementInfo1.getGoodsType()) && "1".equals(contractManagementInfo1.getDeliverType()) && "2".equals(contractManagementInfo1.getContractType())) {
|
|
//定义出库量
|
|
//定义出库量
|
|
- Float outWeight = 0.0f;
|
|
|
|
|
|
+ Double outWeight = 0.0d;
|
|
//查询同名临时库出库量
|
|
//查询同名临时库出库量
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("warehouse_name", contractManagementInfo.getContractNo())
|
|
|
|
- .eq("in_out_flag", "1")
|
|
|
|
- .eq("status_flag", "3")
|
|
|
|
|
|
+ List<StockPurchaseReceiptReport> stockPurchaseReceiptReportList = stockPurchaseReceiptReportService.selectList(new EntityWrapper<StockPurchaseReceiptReport>()
|
|
|
|
+ .eq("warehouse_name", contractManagementInfo1.getContractNo())
|
|
|
|
+ .ge("status_flag", "1")
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
- outWeight = outWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(stockPurchaseReceiptReportList)) {
|
|
|
|
+ for (StockPurchaseReceiptReport stockPurchaseReceiptReport : stockPurchaseReceiptReportList) {
|
|
|
|
+ outWeight = outWeight + stockPurchaseReceiptReport.getSettlementWeight();
|
|
|
|
+ moneyTotal += stockPurchaseReceiptReport.getAmountIngPayable();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//定义退库量
|
|
//定义退库量
|
|
- Float returnWeight = 0.0f;
|
|
|
|
|
|
+ Double returnWeight = 0.0d;
|
|
//查询同名临时库出库量
|
|
//查询同名临时库出库量
|
|
List<WarehouseInOutInfo> warehouseInOutInfoList1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
List<WarehouseInOutInfo> warehouseInOutInfoList1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
- .eq("warehouse_name", contractManagementInfo.getContractNo())
|
|
|
|
|
|
+ .eq("warehouse_name", contractManagementInfo1.getContractNo())
|
|
.eq("in_out_type", "退库")
|
|
.eq("in_out_type", "退库")
|
|
.eq("status_flag", "3")
|
|
.eq("status_flag", "3")
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
@@ -365,27 +369,27 @@ public class BiInfoController {
|
|
returnWeight = returnWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
returnWeight = returnWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- completedQuantity = completedQuantity + outWeight - returnWeight;
|
|
|
|
|
|
+ sumTotal += outWeight - returnWeight;
|
|
}
|
|
}
|
|
//现货他运采购合同
|
|
//现货他运采购合同
|
|
- else if ("1".equals(contractManagementInfo.getGoodsType()) && "2".equals(contractManagementInfo.getDeliverType()) && "2".equals(contractManagementInfo.getContractType())) {
|
|
|
|
|
|
+ else if ("1".equals(contractManagementInfo1.getGoodsType()) && "2".equals(contractManagementInfo1.getDeliverType()) && "2".equals(contractManagementInfo1.getContractType())) {
|
|
//定义出库量
|
|
//定义出库量
|
|
- Float inWeight = 0.0f;
|
|
|
|
|
|
+ Double inWeight = 0.0d;
|
|
//查询同合同编号入库量
|
|
//查询同合同编号入库量
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
|
- .eq("in_out_flag", "2")
|
|
|
|
- .eq("status_flag", "3")
|
|
|
|
|
|
+ List<StockPurchaseReceiptReport> stockPurchaseReceiptReportList = stockPurchaseReceiptReportService.selectList(new EntityWrapper<StockPurchaseReceiptReport>()
|
|
|
|
+ .eq("contract_no", contractManagementInfo1.getContractNo())
|
|
|
|
+ .ge("status_flag", "1")
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
- inWeight = Float.valueOf(inWeight) + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(stockPurchaseReceiptReportList)) {
|
|
|
|
+ for (StockPurchaseReceiptReport stockPurchaseReceiptReport : stockPurchaseReceiptReportList) {
|
|
|
|
+ inWeight = Double.valueOf(inWeight) + stockPurchaseReceiptReport.getSettlementWeight();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- completedQuantity = completedQuantity + inWeight;
|
|
|
|
|
|
+
|
|
|
|
+ completedQuantity += inWeight;
|
|
}
|
|
}
|
|
// 查询已开票未开票
|
|
// 查询已开票未开票
|
|
- ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo.getId()));
|
|
|
|
|
|
+ ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo1.getId()));
|
|
invoicingTotal = invoicingTotal + (contractProcessInfo.getGoodsName() != null ? contractProcessInfo.getGoodsName() : 0.00);
|
|
invoicingTotal = invoicingTotal + (contractProcessInfo.getGoodsName() != null ? contractProcessInfo.getGoodsName() : 0.00);
|
|
payTotal = payTotal + (contractProcessInfo.getMildewGrain() != null ? contractProcessInfo.getMildewGrain() : 0.00);
|
|
payTotal = payTotal + (contractProcessInfo.getMildewGrain() != null ? contractProcessInfo.getMildewGrain() : 0.00);
|
|
}
|
|
}
|
|
@@ -445,8 +449,8 @@ public class BiInfoController {
|
|
BigDecimal bg4 = new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
|
|
BigDecimal bg4 = new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
|
|
biViewInfob2.setCount(String.valueOf(bg4));
|
|
biViewInfob2.setCount(String.valueOf(bg4));
|
|
biViewInfob2.setPercentage((moneyTotal - (payTotal != null ? payTotal : 0)) / moneyTotal * 100 + "%");
|
|
biViewInfob2.setPercentage((moneyTotal - (payTotal != null ? payTotal : 0)) / moneyTotal * 100 + "%");
|
|
- biViewInfosb1.add(biViewInfoa1);
|
|
|
|
- biViewInfosb1.add(biViewInfoa2);
|
|
|
|
|
|
+ biViewInfosb1.add(biViewInfob1);
|
|
|
|
+ biViewInfosb1.add(biViewInfob2);
|
|
biViewInfob.setBiViewInfoList(biViewInfosb1);
|
|
biViewInfob.setBiViewInfoList(biViewInfosb1);
|
|
biViewInfos.add(biViewInfob);
|
|
biViewInfos.add(biViewInfob);
|
|
return biViewInfos;
|
|
return biViewInfos;
|
|
@@ -459,9 +463,9 @@ public class BiInfoController {
|
|
*/
|
|
*/
|
|
private List<BiViewInfo> getCompletedAndNotQuantity(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos) {
|
|
private List<BiViewInfo> getCompletedAndNotQuantity(List<ContractManagementInfo> contractManagementInfos, List<BiViewInfo> biViewInfos) {
|
|
// 销售合同总量
|
|
// 销售合同总量
|
|
- Float sumTotal = 0f;
|
|
|
|
|
|
+ Double sumTotal = 0d;
|
|
// 销售合同完成量
|
|
// 销售合同完成量
|
|
- Float completedQuantity = 0f;
|
|
|
|
|
|
+ Double completedQuantity = 0d;
|
|
// 销售合同总金额
|
|
// 销售合同总金额
|
|
Double moneyTotal = 0.00;
|
|
Double moneyTotal = 0.00;
|
|
// 销售合同已开发票金额
|
|
// 销售合同已开发票金额
|
|
@@ -469,80 +473,47 @@ public class BiInfoController {
|
|
// 销售合同已付款金额
|
|
// 销售合同已付款金额
|
|
Double payTotal = 0.00;
|
|
Double payTotal = 0.00;
|
|
for (int i = 0; i < contractManagementInfos.size(); i++) {
|
|
for (int i = 0; i < contractManagementInfos.size(); i++) {
|
|
- ContractManagementInfo contractManagementInfo = contractManagementInfos.get(i);
|
|
|
|
- if ("2".equals(contractManagementInfo.getContractType())) {
|
|
|
|
|
|
+ ContractManagementInfo contractManagementInfo1 = contractManagementInfos.get(i);
|
|
|
|
+ if ("2".equals(contractManagementInfo1.getContractType())) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- sumTotal = sumTotal + contractManagementInfo.getWeight();
|
|
|
|
- moneyTotal = moneyTotal + contractManagementInfo.getTotalContractPrice();
|
|
|
|
|
|
+ sumTotal = sumTotal + contractManagementInfo1.getWeight();
|
|
|
|
+// moneyTotal = moneyTotal + contractManagementInfo1.getTotalContractPrice();
|
|
//定义出库量
|
|
//定义出库量
|
|
- Float outWeight = 0.0f;
|
|
|
|
|
|
+ Double outWeight = 0.0d;
|
|
|
|
+ //定义退库量
|
|
|
|
+ Double returnWeight = 0.0d;
|
|
|
|
+
|
|
|
|
+ Double payMoney = 0.0d;
|
|
//查询同合同编号出库量
|
|
//查询同合同编号出库量
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
|
- .eq("in_out_flag", "1")
|
|
|
|
- .eq("status_flag", "3")
|
|
|
|
- .eq("delete_flag", "0"));
|
|
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
|
- outWeight = outWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //定义运输损耗
|
|
|
|
- Float loss = 0.0f;
|
|
|
|
- //查询同合同编号的运输任务
|
|
|
|
- TranTaskInfo tranTaskInfo = tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
|
|
|
|
- .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
|
|
|
+ List<StockSaleReceiptReport> stockSaleReceiptReportList = stockSaleReceiptReportService.selectList(new EntityWrapper<StockSaleReceiptReport>()
|
|
|
|
+ .eq("contract_no", contractManagementInfo1.getContractNo())
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
- if (tranTaskInfo != null) {
|
|
|
|
- //定义装车净重
|
|
|
|
- Float loadNetWeight = 0.0f;
|
|
|
|
- //定义卸车净重
|
|
|
|
- Float unloadNetWeight = 0.0f;
|
|
|
|
- //查询运输车辆
|
|
|
|
- List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
|
|
|
|
- .eq("info_id", tranTaskInfo.getId())
|
|
|
|
- .eq("status_flag", "1")
|
|
|
|
- .eq("delete_flag", "0"));
|
|
|
|
- if (!CollectionUtils.isEmpty(tranCarInfoList)) {
|
|
|
|
- for (TranCarInfo tranCarInfo : tranCarInfoList) {
|
|
|
|
- loadNetWeight = loadNetWeight + tranCarInfo.getLoadNetWeight();
|
|
|
|
- unloadNetWeight = unloadNetWeight + tranCarInfo.getUnloadNetWeight();
|
|
|
|
- }
|
|
|
|
- loss = loadNetWeight - unloadNetWeight;
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(stockSaleReceiptReportList)) {
|
|
|
|
+ for (StockSaleReceiptReport stockSaleReceiptReport : stockSaleReceiptReportList) {
|
|
|
|
+ outWeight = outWeight + (stockSaleReceiptReport.getSettlementWeight()!=null?stockSaleReceiptReport.getSettlementWeight():0);
|
|
|
|
+ moneyTotal += (stockSaleReceiptReport.getAmountIngReceivable()!=null?stockSaleReceiptReport.getAmountIngReceivable():0);
|
|
|
|
+ payMoney += (stockSaleReceiptReport.getAmountEdReceivable()!=null?stockSaleReceiptReport.getAmountEdReceivable():0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //定义退库量
|
|
|
|
- Float returnWeight = 0.0f;
|
|
|
|
//查询同合同编号出库量
|
|
//查询同合同编号出库量
|
|
- List<WarehouseInOutInfo> warehouseInOutInfoList1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
|
- .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
|
- .eq("in_out_type", "退库")
|
|
|
|
- .eq("status_flag", "3")
|
|
|
|
|
|
+ List<StockSaleReceiptReport> stockSaleReceiptReportList1 = stockSaleReceiptReportService.selectList(new EntityWrapper<StockSaleReceiptReport>()
|
|
|
|
+ .eq("contract_no", contractManagementInfo1.getContractNo())
|
|
|
|
+ .eq("return_flag", "1")
|
|
|
|
+ .ge("status_flag", "8")
|
|
.eq("delete_flag", "0"));
|
|
.eq("delete_flag", "0"));
|
|
- if (!CollectionUtils.isEmpty(warehouseInOutInfoList1)) {
|
|
|
|
- for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList1) {
|
|
|
|
- returnWeight = returnWeight + Float.valueOf(String.valueOf(warehouseInOutInfo.getNetWeight()));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //自运的销售合同
|
|
|
|
- if ("1".equals(contractManagementInfo.getDeliverType())) {
|
|
|
|
- //已完货的粮款结算阶段
|
|
|
|
- TranProcessInfo tranProcessInfo = tranProcessInfoService.selectOne(new EntityWrapper<TranProcessInfo>()
|
|
|
|
- .eq("end_flag", "1")
|
|
|
|
- .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
|
- .eq("receiving_status_flag", "1"));
|
|
|
|
- if (tranProcessInfo != null) {
|
|
|
|
- //完成量等于完货净重
|
|
|
|
- completedQuantity = completedQuantity + tranProcessInfo.getWeight();
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(stockSaleReceiptReportList1)) {
|
|
|
|
+ for (StockSaleReceiptReport stockSaleReceiptReport : stockSaleReceiptReportList1) {
|
|
|
|
+ returnWeight = returnWeight + stockSaleReceiptReport.getSettlementWeight();
|
|
|
|
+ payMoney -= stockSaleReceiptReport.getAmountEdReceivable();
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- completedQuantity = completedQuantity + (outWeight - loss - returnWeight);
|
|
|
|
}
|
|
}
|
|
|
|
+ completedQuantity += outWeight - returnWeight;
|
|
// 查询已开票未开票
|
|
// 查询已开票未开票
|
|
- ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo.getId()));
|
|
|
|
|
|
+ ContractProcessInfo contractProcessInfo = contractProcessInfoService.selectOne(new EntityWrapper<ContractProcessInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, contractManagementInfo1.getId()));
|
|
invoicingTotal = invoicingTotal + (contractProcessInfo.getGoodsName() != null ? contractProcessInfo.getGoodsName() : 0.00);
|
|
invoicingTotal = invoicingTotal + (contractProcessInfo.getGoodsName() != null ? contractProcessInfo.getGoodsName() : 0.00);
|
|
- payTotal = payTotal + (contractProcessInfo.getGoodsNameKey() != null ? contractProcessInfo.getGoodsNameKey() : 0.00);
|
|
|
|
|
|
+// payTotal += payMoney;
|
|
|
|
+ payTotal = payTotal + (contractProcessInfo.getMildewGrain() != null ? contractProcessInfo.getMildewGrain() : 0.00);
|
|
}
|
|
}
|
|
// 执行中的所有合同量求和-- 已完成量、待完成量
|
|
// 执行中的所有合同量求和-- 已完成量、待完成量
|
|
BiViewInfo biViewInfo = new BiViewInfo();
|
|
BiViewInfo biViewInfo = new BiViewInfo();
|
|
@@ -600,8 +571,8 @@ public class BiInfoController {
|
|
BigDecimal bg6 = new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
|
|
BigDecimal bg6 = new BigDecimal(moneyTotal - (payTotal != null ? payTotal : 0));
|
|
biViewInfob2.setCount(String.valueOf(bg6));
|
|
biViewInfob2.setCount(String.valueOf(bg6));
|
|
biViewInfob2.setPercentage((moneyTotal - (payTotal != null ? payTotal : 0)) / moneyTotal * 100 + "%");
|
|
biViewInfob2.setPercentage((moneyTotal - (payTotal != null ? payTotal : 0)) / moneyTotal * 100 + "%");
|
|
- biViewInfosb1.add(biViewInfoa1);
|
|
|
|
- biViewInfosb1.add(biViewInfoa2);
|
|
|
|
|
|
+ biViewInfosb1.add(biViewInfob1);
|
|
|
|
+ biViewInfosb1.add(biViewInfob2);
|
|
biViewInfob.setBiViewInfoList(biViewInfosb1);
|
|
biViewInfob.setBiViewInfoList(biViewInfosb1);
|
|
biViewInfos.add(biViewInfob);
|
|
biViewInfos.add(biViewInfob);
|
|
return biViewInfos;
|
|
return biViewInfos;
|