zhangyuewww 1 год назад
Родитель
Сommit
5492079a2c
16 измененных файлов с 212 добавлено и 164 удалено
  1. 3 3
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/StockPurchaseReceiptReportController.java
  2. 3 3
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/StockSaleReceiptReportController.java
  3. 8 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TranProcessInfo.java
  4. 1 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/TranSettlementReport.java
  5. 4 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/view/WarehouseNumView.java
  6. 2 2
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IStockPurchaseReceiptReportService.java
  7. 2 2
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IStockSaleReceiptReportService.java
  8. 56 49
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/StockPurchaseReceiptReportServiceImpl.java
  9. 66 65
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/StockSaleReceiptReportServiceImpl.java
  10. 20 16
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranProcessInfoServiceImpl.java
  11. 12 1
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/TranSettlementReportServiceImpl.java
  12. 2 4
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java
  13. 18 17
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/StockPurchaseReceiptReportMapper.xml
  14. 1 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/StockSaleReceiptReportMapper.xml
  15. 2 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/TranSettlementReportMapper.xml
  16. 12 1
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehouseBaseInfoMapper.xml

+ 3 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/StockPurchaseReceiptReportController.java

@@ -66,12 +66,12 @@ public class StockPurchaseReceiptReportController {
     }
     /**
      * 合同编号下拉列表
-     * @param compId
+     * @param stockPurchaseReceiptReport
      * @return
      */
     @GetMapping("/selectContractNoList")
-    public List<ContractManagementInfo> selectContractNoList(String compId) {
-        return stockPurchaseReceiptReportService.selectContractNoList(compId);
+    public List<ContractManagementInfo> selectContractNoList(StockPurchaseReceiptReport stockPurchaseReceiptReport) {
+        return stockPurchaseReceiptReportService.selectContractNoList(stockPurchaseReceiptReport);
     }
     /**
      * 查看

+ 3 - 3
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/StockSaleReceiptReportController.java

@@ -72,12 +72,12 @@ public class StockSaleReceiptReportController {
 
     /**
      * 合同编号下拉列表
-     * @param compId
+     * @param stockSaleReceiptReport
      * @return
      */
     @GetMapping("/selectContractNoList")
-    public List<ContractManagementInfo> selectContractNoList(String compId) {
-        return stockSaleReceiptReportService.selectContractNoList(compId);
+    public List<ContractManagementInfo> selectContractNoList(StockSaleReceiptReport stockSaleReceiptReport) {
+        return stockSaleReceiptReportService.selectContractNoList(stockSaleReceiptReport);
     }
     /**
      * 批量开发票

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

@@ -87,6 +87,14 @@ public class TranProcessInfo extends BaseModel<TranProcessInfo> {
      * 货名
      */
     private String goodsName;
+    /**
+     * 货值(元/吨)
+     */
+    private Double goodsValue;
+    /**
+     * 审核中的货值(元/吨)
+     */
+    private Double goodsValueIng;
     /**
      * 重量(吨)
      */

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

@@ -128,7 +128,7 @@ public class TranSettlementReport extends BaseModel<TranSettlementReport> {
      */
     private Double cargoDamage;
     /**
-     * 粮食单价
+     * 货值
      */
     private Double grainPrice;
     /**

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

@@ -40,4 +40,8 @@ public class WarehouseNumView {
      * 销售在途
      */
     private Float saleNum;
+    /**
+     * 成本
+     */
+    private Double cost;
 }

+ 2 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IStockPurchaseReceiptReportService.java

@@ -48,9 +48,9 @@ public interface IStockPurchaseReceiptReportService extends IService<StockPurcha
     /**
      * 合同编号下拉列表
      *
-     * @param compId
+     * @param stockPurchaseReceiptReport
      */
-    List<ContractManagementInfo> selectContractNoList(String compId);
+    List<ContractManagementInfo> selectContractNoList(StockPurchaseReceiptReport stockPurchaseReceiptReport);
     /**
      * 查看
      *

+ 2 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IStockSaleReceiptReportService.java

@@ -52,9 +52,9 @@ public interface IStockSaleReceiptReportService extends IService<StockSaleReceip
     /**
      * 合同编号下拉列表
      *
-     * @param compId
+     * @param stockSaleReceiptReport
      */
-    List<ContractManagementInfo> selectContractNoList(String compId);
+    List<ContractManagementInfo> selectContractNoList(StockSaleReceiptReport stockSaleReceiptReport);
     /**
      * 批量开发票
      * @param stockSaleReceiptReport

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

@@ -75,16 +75,16 @@ public class StockPurchaseReceiptReportServiceImpl extends ServiceImpl<StockPurc
         Map<String, Object> pageView = new HashMap<>();
         pageView.put("startRecord", (stockPurchaseReceiptReport.getCurrentPage() - 1)
                 * stockPurchaseReceiptReport.getPageSize());
-        List<String> businessKeys = null;
-        if ("1".equals(stockPurchaseReceiptReport.getSearchType())) {
-            businessKeys = workflowService.getTaskBusinessKeysByCode("STOCK-PROCUREMENT-RECEIPT-REPORT");
-        }
-        List<String> statusSet = new ArrayList<>();
-        List<String> resourceIdList = this.getResourceIdList();
-        if (resourceIdList.contains("procurementStockInReport-Edit")) { // 填写,提交    权限做完以后替换
-            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
-            statusSet.addAll(statusList);
-        }
+//        List<String> businessKeys = null;
+//        if ("1".equals(stockPurchaseReceiptReport.getSearchType())) {
+//            businessKeys = workflowService.getTaskBusinessKeysByCode("STOCK-PROCUREMENT-RECEIPT-REPORT");
+//        }
+//        List<String> statusSet = new ArrayList<>();
+//        List<String> resourceIdList = this.getResourceIdList();
+//        if (resourceIdList.contains("procurementStockInReport-Edit")) { // 填写,提交    权限做完以后替换
+//            List<String> statusList = Lists.newArrayList(StatusEnum.PUR_RETURN.getFlag());
+//            statusSet.addAll(statusList);
+//        }
         //公司id
         pageView.put("compId", stockPurchaseReceiptReport.getCompId());
         pageView.put("searchKeyWord", stockPurchaseReceiptReport.getSearchKeyWord());
@@ -95,26 +95,24 @@ public class StockPurchaseReceiptReportServiceImpl extends ServiceImpl<StockPurc
         pageView.put("currentPage", stockPurchaseReceiptReport.getCurrentPage());
         pageView.put("contractNo", stockPurchaseReceiptReport.getContractNo());
         pageView.put("statusFlag", stockPurchaseReceiptReport.getStatusFlag());
-        pageView.put("businessKeys", businessKeys);
-        pageView.put("statusSet", statusSet);
+//        pageView.put("businessKeys", businessKeys);
+//        pageView.put("statusSet", statusSet);
         // 查询采购入库总数
         Integer dataCount = baseMapper.getCountByCondition(pageView);
         List<StockPurchaseReceiptReport> dataList = baseMapper.getListByCondition(pageView);
         if (!CollectionUtils.isEmpty(dataList)) {
             for (StockPurchaseReceiptReport purchaseReceiptReport1:dataList){
-                WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
-                .eq("contract_no",purchaseReceiptReport1.getContractNo())
-                .eq("car_no",purchaseReceiptReport1.getCarNo()).eq("warehouse_name",purchaseReceiptReport1.getWarehouseName()));
+                WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectById(purchaseReceiptReport1.getWarehouseRecordId());
                 if (warehouseInOutInfo!=null){
                     purchaseReceiptReport1.setPoundImg(warehouseInOutInfo.getAddressUrl());
                 }
-                String taskId = "";
-                // 只有待审核状态才有taskId
-                if (StringUtils.isNotBlank(purchaseReceiptReport1.getWorkflowId())) {
-                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(purchaseReceiptReport1.getWorkflowId()), purchaseReceiptReport1.getId());
-                    taskId = jsonObject.getString("taskId");
-                    purchaseReceiptReport1.setTaskId(taskId);
-                }
+//                String taskId = "";
+//                // 只有待审核状态才有taskId
+//                if (StringUtils.isNotBlank(purchaseReceiptReport1.getWorkflowId())) {
+//                    JSONObject jsonObject = workflowService.getActiveTask(Lists.newArrayList(purchaseReceiptReport1.getWorkflowId()), purchaseReceiptReport1.getId());
+//                    taskId = jsonObject.getString("taskId");
+//                    purchaseReceiptReport1.setTaskId(taskId);
+//                }
             }
         }
         Page<StockPurchaseReceiptReport> page = new Page<>();
@@ -227,35 +225,44 @@ public class StockPurchaseReceiptReportServiceImpl extends ServiceImpl<StockPurc
     /**
      * 合同编号下拉列表
      *
-     * @param compId
+     * @param stockPurchaseReceiptReport
      */
     @Override
-    public List<ContractManagementInfo> selectContractNoList(String compId) {
-        //查现货采购合同
-        List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
-                .eq("comp_id", compId)
-                .eq("contract_type", "2")
-                .eq("delete_flag", "0")
-                .orderBy("update_date", false));
-
-        for (ContractManagementInfo contractManagementInfo : contractManagementInfoList) {
-            ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
-                    .eq("contract_id",contractManagementInfo.getId()));
-            contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
-            Double money = 0.0d;
-            //查现货采购入库报表
-            List<StockPurchaseReceiptReport> stockPurchaseReceiptReportList = this.selectList(new EntityWrapper<StockPurchaseReceiptReport>()
-                    .eq("contract_no", contractManagementInfo.getContractNo())
-                    .eq("delete_flag", "0"));
-            if (!CollectionUtils.isEmpty(stockPurchaseReceiptReportList)) {
-                for (StockPurchaseReceiptReport stockPurchaseReceiptReport : stockPurchaseReceiptReportList) {
-                    money = money + (stockPurchaseReceiptReport.getAmountNotPayable()!=null?stockPurchaseReceiptReport.getAmountNotPayable():0d);
-                }
-                //有未付金额
-                if (money > 0) {
-                    contractManagementInfo.setReportStatus("待结算");
-                } else {
-                    contractManagementInfo.setReportStatus("已结算");
+    public List<ContractManagementInfo> selectContractNoList(StockPurchaseReceiptReport stockPurchaseReceiptReport) {
+        List<ContractManagementInfo> contractManagementInfoList=new ArrayList<>();
+        //查现货采购入库报表
+        List<StockPurchaseReceiptReport> stockPurchaseReceiptReportList = this.selectList(new EntityWrapper<StockPurchaseReceiptReport>()
+                .eq("comp_id", stockPurchaseReceiptReport.getCompId())
+                .gt("create_date",stockPurchaseReceiptReport.getStartDate())
+                .lt("create_date",stockPurchaseReceiptReport.getEndDate())
+                .groupBy("contract_no")
+                .eq("delete_flag", "0"));
+        if (!CollectionUtils.isEmpty(stockPurchaseReceiptReportList)) {
+            for (StockPurchaseReceiptReport stockPurchaseReceiptReport1 : stockPurchaseReceiptReportList) {
+                ContractManagementInfo contractManagementInfo= contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                        .eq("comp_id", stockPurchaseReceiptReport1.getCompId())
+                        .eq("contract_no",stockPurchaseReceiptReport1.getContractNo()));
+                if (contractManagementInfo!=null){
+                    ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
+                            .eq("contract_id",contractManagementInfo.getId()));
+                    contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
+                    Double money = 0.0d;
+                    List<StockPurchaseReceiptReport> stockPurchaseReceiptReportList1 = this.selectList(new EntityWrapper<StockPurchaseReceiptReport>()
+                            .eq("comp_id", stockPurchaseReceiptReport1.getCompId())
+                            .eq("contract_no",contractManagementInfo.getContractNo())
+                            .gt("create_date",stockPurchaseReceiptReport.getStartDate())
+                            .lt("create_date",stockPurchaseReceiptReport.getEndDate())
+                            .eq("delete_flag", "0"));
+                    if (!CollectionUtils.isEmpty(stockPurchaseReceiptReportList1)){
+                        money = (stockPurchaseReceiptReportList1.stream().mapToDouble(StockPurchaseReceiptReport::getAmountNotPayable).sum()) ;
+                    }
+                    //有未付金额
+                    if (money > 0) {
+                        contractManagementInfo.setReportStatus("待结算");
+                    } else {
+                        contractManagementInfo.setReportStatus("已结算");
+                    }
+                    contractManagementInfoList.add(contractManagementInfo);
                 }
             }
         }

+ 66 - 65
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/StockSaleReceiptReportServiceImpl.java

@@ -23,10 +23,7 @@ import org.springframework.util.CollectionUtils;
 
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -95,10 +92,7 @@ public class StockSaleReceiptReportServiceImpl extends ServiceImpl<StockSaleRece
         List<StockSaleReceiptReport> dataList = baseMapper.getListByCondition(pageView);
         if (!CollectionUtils.isEmpty(dataList)) {
             for (StockSaleReceiptReport saleReceiptReport1:dataList){
-                WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectOne(new EntityWrapper<WarehouseInOutInfo>()
-                        .eq("contract_no",saleReceiptReport1.getContractNo())
-                        .eq("car_no",saleReceiptReport1.getCarNo())
-                        .eq("warehouse_name",saleReceiptReport1.getWarehouseName()));
+                WarehouseInOutInfo warehouseInOutInfo=warehouseInOutInfoService.selectById(saleReceiptReport1.getWarehouseRecordId());
                 if (warehouseInOutInfo!=null){
                     saleReceiptReport1.setPoundImg(warehouseInOutInfo.getAddressUrl());
                 }
@@ -285,71 +279,78 @@ public class StockSaleReceiptReportServiceImpl extends ServiceImpl<StockSaleRece
     /**
      * 合同编号下拉列表
      *
-     * @param compId
+     * @param stockSaleReceiptReport
      */
     @Override
-    public List<ContractManagementInfo> selectContractNoList(String compId) {
-        //查现货销售合同
-        List<ContractManagementInfo> contractManagementInfoList = contractManagementInfoService.selectList(new EntityWrapper<ContractManagementInfo>()
-                .eq("comp_id", compId)
-                .eq("contract_type", "1")
-                .eq("delete_flag", "0")
-                .eq("goods_type","1")
-                .orderBy("update_date", false));
-        for (ContractManagementInfo contractManagementInfo : contractManagementInfoList) {
-            List<TranTaskInfo> tranTaskInfoList=tranTaskInfoService.selectList(new EntityWrapper<TranTaskInfo>()
-                .eq("comp_id",contractManagementInfo.getCompId())
-                .eq("contract_no",contractManagementInfo.getContractNo()));
-            if (!CollectionUtils.isEmpty(tranTaskInfoList)){
-                for(TranTaskInfo tranTaskInfo:tranTaskInfoList){
-                    TranProcessInfo tranProcessInfo=tranProcessInfoService.selectOne(new EntityWrapper<TranProcessInfo>()
-                            .eq("info_id",tranTaskInfo.getId())
-                            .eq("end_flag","1"));
-                    if (tranProcessInfo!=null){
-                        if ("船运".equals(tranProcessInfo.getTranType())) {
-                            TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
-                                    .eq("process_id", tranProcessInfo.getId())
-                                    .eq("ship_type", "集装箱"));
-                            if (tranCarInfo != null) {
-                                tranProcessInfo.setTranType("箱船");
-                                tranTaskInfo.setTranProcessInfo(tranProcessInfo);
-                            }
-                            TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
-                                    .eq("process_id", tranProcessInfo.getId())
-                                    .eq("ship_type", "散船"));
-                            if (tranCarInfo1 != null) {
-                                tranProcessInfo.setTranType("散船");
-                                tranTaskInfo.setTranProcessInfo(tranProcessInfo);
-                            }
-                        }
-                        else
-                        {
-                            tranTaskInfo.setTranProcessInfo(tranProcessInfo);
-                        }
-                    }
-                }
-                contractManagementInfo.setTranTaskInfoList(tranTaskInfoList);
-            }
-            ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
-                    .eq("contract_id",contractManagementInfo.getId()));
-            contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
-            Double money = 0.00;
+    public List<ContractManagementInfo> selectContractNoList(StockSaleReceiptReport stockSaleReceiptReport) {
+        List<ContractManagementInfo> contractManagementInfoList=new ArrayList<>();
             //查现货销售出库报表
             List<StockSaleReceiptReport> stockSaleReceiptReportList = this.selectList(new EntityWrapper<StockSaleReceiptReport>()
-                    .eq("contract_no", contractManagementInfo.getContractNo())
+                    .eq("comp_id", stockSaleReceiptReport.getCompId())
+                    .gt("create_date",stockSaleReceiptReport.getStartDate())
+                    .lt("create_date",stockSaleReceiptReport.getEndDate())
+                    .groupBy("contract_no")
                     .eq("delete_flag", "0"));
             if (!CollectionUtils.isEmpty(stockSaleReceiptReportList)) {
-                for (StockSaleReceiptReport stockSaleReceiptReport : stockSaleReceiptReportList) {
-                    money = money + (stockSaleReceiptReport.getAmountNotReceivable()!=null?stockSaleReceiptReport.getAmountNotReceivable():0.0);
-                }
-                //有未收金额
-                if (money > 0) {
-                    contractManagementInfo.setReportStatus("待结算");
-                } else {
-                    contractManagementInfo.setReportStatus("已结算");
+                for (StockSaleReceiptReport stockSaleReceiptReport1 : stockSaleReceiptReportList) {
+                    ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+                            .eq("comp_id", stockSaleReceiptReport1.getCompId())
+                            .eq("contract_no", stockSaleReceiptReport1.getContractNo()));
+                    if (contractManagementInfo != null) {
+                        ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>()
+                                .eq("contract_id", contractManagementInfo.getId()));
+                        contractManagementInfo.setGoodsName(contractGoodsInfo.getGoodsName());
+                        List<TranTaskInfo> tranTaskInfoList = tranTaskInfoService.selectList(new EntityWrapper<TranTaskInfo>()
+                                .eq("comp_id", contractManagementInfo.getCompId())
+                                .eq("contract_no", contractManagementInfo.getContractNo()));
+                        if (!CollectionUtils.isEmpty(tranTaskInfoList)) {
+                            for (TranTaskInfo tranTaskInfo : tranTaskInfoList) {
+                                TranProcessInfo tranProcessInfo = tranProcessInfoService.selectOne(new EntityWrapper<TranProcessInfo>()
+                                        .eq("info_id", tranTaskInfo.getId())
+                                        .eq("end_flag", "1"));
+                                if (tranProcessInfo != null) {
+                                    if ("船运".equals(tranProcessInfo.getTranType())) {
+                                        TranCarInfo tranCarInfo = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
+                                                .eq("process_id", tranProcessInfo.getId())
+                                                .eq("ship_type", "集装箱"));
+                                        if (tranCarInfo != null) {
+                                            tranProcessInfo.setTranType("箱船");
+                                            tranTaskInfo.setTranProcessInfo(tranProcessInfo);
+                                        }
+                                        TranCarInfo tranCarInfo1 = tranCarInfoService.selectOne(new EntityWrapper<TranCarInfo>()
+                                                .eq("process_id", tranProcessInfo.getId())
+                                                .eq("ship_type", "散船"));
+                                        if (tranCarInfo1 != null) {
+                                            tranProcessInfo.setTranType("散船");
+                                            tranTaskInfo.setTranProcessInfo(tranProcessInfo);
+                                        }
+                                    } else {
+                                        tranTaskInfo.setTranProcessInfo(tranProcessInfo);
+                                    }
+                                }
+                            }
+                            contractManagementInfo.setTranTaskInfoList(tranTaskInfoList);
+                        }
+                        Double money = 0.0d;
+                        List<StockSaleReceiptReport> stockSaleReceiptReportList1 = this.selectList(new EntityWrapper<StockSaleReceiptReport>()
+                                .eq("comp_id", stockSaleReceiptReport.getCompId())
+                                .eq("contract_no",stockSaleReceiptReport1.getContractNo())
+                                .gt("create_date",stockSaleReceiptReport.getStartDate())
+                                .lt("create_date",stockSaleReceiptReport.getEndDate())
+                                .eq("delete_flag", "0"));
+                        if (!CollectionUtils.isEmpty(stockSaleReceiptReportList1)){
+                            money = (stockSaleReceiptReportList1.stream().mapToDouble(StockSaleReceiptReport::getAmountNotReceivable).sum()) ;
+                        }
+                        //有未收金额
+                        if (money > 0) {
+                            contractManagementInfo.setReportStatus("待结算");
+                        } else {
+                            contractManagementInfo.setReportStatus("已结算");
+                        }
+                        contractManagementInfoList.add(contractManagementInfo);
+                    }
                 }
             }
-        }
         return contractManagementInfoList;
     }
 

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

@@ -348,22 +348,23 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setStartAddress(tranTaskInfo.getSendWarehouse());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                 tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
-                                ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                                        .eq("contract_no", tranSettlementReport.getContractNo())
-                                        .eq("delete_flag", "0"));
-                                if (contractManagementInfo!=null){
-                                    tranSettlementReport.setGrainPrice(contractManagementInfo.getUnitContractPrice());
-                                }
-                                else {
-                                    if ("移库".equals(tranTaskInfo.getTaskType())) {
-                                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
-                                                .eq("contract_no", tranTaskInfo.getSendWarehouse())
-                                                .eq("comp_id", tranTaskInfo.getCompId()));
-                                        if (contractManagementInfo1 != null) {
-                                            tranSettlementReport.setGrainPrice(contractManagementInfo1.getUnitContractPrice());
-                                        }
-                                    }
-                                }
+                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
+//                                ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+//                                        .eq("contract_no", tranSettlementReport.getContractNo())
+//                                        .eq("delete_flag", "0"));
+//                                if (contractManagementInfo!=null){
+//                                    tranSettlementReport.setGrainPrice(contractManagementInfo.getUnitContractPrice());
+//                                }
+//                                else {
+//                                    if ("移库".equals(tranTaskInfo.getTaskType())) {
+//                                        ContractManagementInfo contractManagementInfo1 = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
+//                                                .eq("contract_no", tranTaskInfo.getSendWarehouse())
+//                                                .eq("comp_id", tranTaskInfo.getCompId()));
+//                                        if (contractManagementInfo1 != null) {
+//                                            tranSettlementReport.setGrainPrice(contractManagementInfo1.getUnitContractPrice());
+//                                        }
+//                                    }
+//                                }
                                 tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
                                 tranSettlementReport.setName(tranCarInfo.getDriver());
                                 tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
@@ -444,6 +445,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setId(IdGenerator.generateUUID());
                                 tranSettlementReport.setTranType("火运");
                                 tranSettlementReport.setTranTypeKey("2");
+                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                 tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                                 tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
@@ -473,6 +475,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                                 tranSettlementReport.setCompId(tranTaskInfo.getCompId());
                                 tranSettlementReport.setCarId(tranCarInfo.getId());
                                 tranSettlementReport.setId(IdGenerator.generateUUID());
+                                tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                                 tranSettlementReport.setTranType("船运");
                                 tranSettlementReport.setTranTypeKey("3");
                                 tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
@@ -584,6 +587,7 @@ public class TranProcessInfoServiceImpl extends ServiceImpl<TranProcessInfoMappe
                             tranSettlementReport.setTaskNo(tranTaskInfo.getTaskNo());
                             tranSettlementReport.setContractNo(tranTaskInfo.getContractNo());
                             tranSettlementReport.setProcessNo(tranProcessInfo.getProcessNo());
+                            tranSettlementReport.setGrainPrice(tranProcessInfo.getGoodsValue());
                             tranSettlementReport.setName(tranCarInfo.getDriver());
                             tranSettlementReport.setPhone(tranCarInfo.getDriverPhone());
                             tranSettlementReport.setCarNo(tranCarInfo.getCarNo());

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

@@ -1076,7 +1076,8 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         sheet.setColumnWidth(20, 12 * 256 + 184);
         sheet.setColumnWidth(21, 12 * 256 + 184);
         sheet.setColumnWidth(22, 12 * 256 + 184);
-        sheet.setColumnWidth(23, 1 * 256 + 184);
+        sheet.setColumnWidth(23, 12 * 256 + 184);
+        sheet.setColumnWidth(24, 1 * 256 + 184);
 
         // 创建单元格对象
         HSSFCell cell = null;
@@ -1142,6 +1143,8 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         cell.setCellStyle(styleTitle);
         cell = row0.createCell(22);
         cell.setCellStyle(styleTitle);
+        cell = row0.createCell(23);
+        cell.setCellStyle(styleTitle);
         rownum++;
 
 
@@ -1251,6 +1254,8 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         cell.setCellStyle(contextstyle1);
         cell = rowp.createCell(22);
         cell.setCellStyle(styleDetail);
+        cell = rowp.createCell(23);
+        cell.setCellStyle(styleDetail);
         rownum++;
 
         HSSFRow row1 = sheet.createRow((int) rownum);
@@ -1319,6 +1324,9 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
         cell.setCellValue("已开发票(元)");
         cell.setCellStyle(styleDetail);
         cell = row1.createCell(22);
+        cell.setCellValue("平均单价(元/吨)");
+        cell.setCellStyle(styleDetail);
+        cell = row1.createCell(23);
         cell.setCellValue("付款日期");
         cell.setCellStyle(styleDetail);
         rownum++;
@@ -1402,6 +1410,9 @@ public class TranSettlementReportServiceImpl extends ServiceImpl<TranSettlementR
                 cell.setCellValue(editFloat(tranSettlementReport1.getAlreadyInvoice()));
                 cell.setCellStyle(contextstyle);
                 cell = rowx.createCell(22);
+                cell.setCellValue(editDouble(tranSettlementReport1.getGrainPrice()));
+                cell.setCellStyle(contextstyle);
+                cell = rowx.createCell(23);
                 String date1 = addDateOneDay(tranSettlementReport1.getPaymentDate() != null ? tranSettlementReport1.getPaymentDate() : new Date());
                 cell.setCellValue(date1);
                 cell.setCellStyle(styleDetail);

+ 2 - 4
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseBaseInfoServiceImpl.java

@@ -234,6 +234,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                                             .eq("position_id", warehousePositionInfo.getId()).eq("in_out_flag", "2").eq("delete_flag", "0")
                                             .eq("status_flag", "3").eq("goods_name", warehouseInOutInfo.getGoodsName()));
                                     if (!CollectionUtils.isEmpty(warehouseInOutInfoAllList)) {
+                                        warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
                                         Double netWeight = 0d;
                                         for (WarehouseInOutInfo warehouse : warehouseInOutInfoAllList) {
                                             //潮粮累计纯重,干粮累计净重
@@ -246,7 +247,6 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                                             netWeight = (double) (Math.round(new BigDecimal(netWeight).add(new BigDecimal(warehouse.getNetWeight())).doubleValue() * 1000)) / 1000;
 //                                            netWeight = (float)(Math.round(((float)(Math.round(netWeight*1000))/1000+(float)(Math.round(warehouse.getNetWeight()*1000))/1000)*1000))/1000;
                                         }
-                                        warehouseNumView.setGoodsName(warehouseInOutInfoAllList.get(0).getGoodsName());
                                         DecimalFormat decimalFormat = new DecimalFormat(".000");//构造方法的字符格式这里如果小数不足2位,会以0补足.
                                         warehouseNumView.setInNetWeight(decimalFormat.format(netWeight));
                                         if (StringUtils.isEmpty(inNetWeight)) {
@@ -621,9 +621,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
                         List<WarehousePositionStorageInfo> warehousePositionStorageInfos = warehousePositionStorageInfoService.selectList(new EntityWrapper<WarehousePositionStorageInfo>()
                                 .eq("position_id", warehousePositionInfo.getId()));
                         if (!CollectionUtils.isEmpty(warehousePositionStorageInfos)) {
-                            for (WarehousePositionStorageInfo warehousePositionStorageInfo : warehousePositionStorageInfos) {
-                                temp.add(warehousePositionStorageInfo);
-                            }
+                            temp.addAll(warehousePositionStorageInfos);
                         }
                     }
                     warehouseBaseInfo.setGoodsNameInfos(temp);

+ 18 - 17
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/StockPurchaseReceiptReportMapper.xml

@@ -52,6 +52,7 @@
         SELECT
         id,
         comp_id as compId,
+        warehouse_record_id as warehouseRecordId,
         contract_no as contractNo,
         car_no as carNo,
         warehousing_date as warehousingDate,
@@ -96,23 +97,23 @@
             AND (DATE_FORMAT(create_date,"%Y%m%d") &lt;=
             DATE_FORMAT(#{endDate},"%Y%m%d"))
         </if>
-        <if test="businessKeys != null and businessKeys.size > 0">
-            and(
-            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">
-                id = #{businessValue}
-            </foreach>
-            )
-        </if>
-        <if test="statusSet != null and statusSet.size > 0">
-            or (
-            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">
-                status_flag =
-                <if test="statusId != null">
-                    #{statusId}
-                </if>
-            </foreach>
-            )
-        </if>
+<!--        <if test="businessKeys != null and businessKeys.size > 0">-->
+<!--            and(-->
+<!--            <foreach collection="businessKeys" item="businessValue" open="(" close=")" separator="or">-->
+<!--                id = #{businessValue}-->
+<!--            </foreach>-->
+<!--            )-->
+<!--        </if>-->
+<!--        <if test="statusSet != null and statusSet.size > 0">-->
+<!--            or (-->
+<!--            <foreach collection="statusSet" item="statusId" separator="or" open="(" close=")">-->
+<!--                status_flag =-->
+<!--                <if test="statusId != null">-->
+<!--                    #{statusId}-->
+<!--                </if>-->
+<!--            </foreach>-->
+<!--            )-->
+<!--        </if>-->
         ORDER BY warehousing_date DESC
         <if test="currentPage != null and currentPage != ''">
             LIMIT ${startRecord}, ${pageSize}

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

@@ -40,6 +40,7 @@
         comp_id as compId,
         contract_no as contractNo,
         car_no as carNo,
+        warehouse_record_id as warehouseRecordId,
         delivery_date as deliveryDate,
         process_no as processNo,
         tran_car_no as tranCarNo,

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

@@ -8,6 +8,7 @@
         FROM tran_settlement_report
         WHERE
         delete_flag = '0'
+        AND create_date > '2023-01-01'
         AND comp_id = #{compId}
         <if test="searchType != null and searchType != ''">
             <if test="searchType == 1">
@@ -132,6 +133,7 @@
         WHERE
         delete_flag = '0'
         AND comp_id = #{compId}
+        AND create_date > '2023-01-01'
         <if test="searchType != null and searchType != ''">
             <if test="searchType == 1">
                 AND status='待请款'  and approve_status is not null

+ 12 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/WarehouseBaseInfoMapper.xml

@@ -585,7 +585,18 @@
             resultType="com.yh.saas.plugin.yiliangyiyun.entity.view.WarehouseNumView">
         SELECT
         	wpsi.goods_name AS goodsName,
-        	sum( wpsi.STORAGE ) AS stockNum
+        	sum( wpsi.STORAGE ) AS stockNum,
+            (
+            SELECT
+            ROUND( AVG( wo.avg_cost ), 3 )
+            FROM
+            warehousing_order wo
+            WHERE
+            wo.warehouse_name = wbi.warehouse_name
+            AND wo.delete_flag = 0
+            AND wbi.comp_id = wo.comp_id
+            and wo.goods_name = wpsi.goods_name
+            ) AS cost
         FROM
         	warehouse_base_info wbi
         	LEFT JOIN warehouse_position_info wpi ON wpi.base_id = wbi.id