lazhaoqian 4 gadi atpakaļ
vecāks
revīzija
5d074d9c80
16 mainītis faili ar 1197 papildinājumiem un 32 dzēšanām
  1. 67 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/anpin/AnPinAllot.java
  2. 16 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java
  3. 66 0
      ruoyi-warehouse/src/main/java/com/ruoyi/anpin/InventoryLedgerExcel.java
  4. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java
  5. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java
  6. 5 0
      ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java
  7. 56 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java
  8. 58 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java
  9. 7 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java
  10. 19 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java
  11. 15 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java
  12. 2 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java
  13. 147 15
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  14. 22 0
      ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml
  15. 289 5
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml
  16. 414 12
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

+ 67 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/anpin/AnPinAllot.java

@@ -0,0 +1,67 @@
+package com.ruoyi.web.controller.anpin;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.ServletUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.spring.SpringUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
+import com.ruoyi.warehouseBusiness.service.ITWarehousebillsfeesService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 安品调拨
+ */
+@RestController
+@RequestMapping("/anPin/anPinAllot")
+public class AnPinAllot  extends BaseController {
+    @Autowired
+    private ITWarehouseBillsService tWarehousebillsService;
+    @Autowired
+    private ITWarehousebillsfeesService itWarehousebillsfeesService;
+
+    /**
+     * 查询调拨列表
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:anPinAllot:cannibalizeList')")
+    @Log(title = "仓库调拨列表", businessType = BusinessType.DELETE)
+    @GetMapping("/cannibalizeList")
+    public TableDataInfo cannibalizeList(TWarehouseBills tWarehousebills) {
+        startPage();
+        tWarehousebills.setfBilltype("DB");
+        List<TWarehouseBills> list = tWarehousebillsService.cannibalizeList(tWarehousebills);
+        return getDataTable(list);
+    }
+    /**
+     * 获取调拨详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('anpin:anPinAllot:query')")
+    @GetMapping(value = "/{fId}")
+    public AjaxResult getInfo(@PathVariable("fId") Long fId) {
+        return AjaxResult.success(tWarehousebillsService.selectAnPinById(fId));
+    }
+    @PreAuthorize("@ss.hasPermi('anpin:stockControl:cannibalize')")
+    @Log(title = "仓库调拨提交", businessType = BusinessType.DELETE)
+    @PostMapping("/cannibalize")
+    public AjaxResult cannibalize(@RequestBody TWarehouseBills tWarehouseBills) {
+        if (tWarehouseBills.getfId() == null){
+            return AjaxResult.error("请选择要调拨的物品");
+        }
+        if (tWarehouseBills.getfTypeid() == null){
+            return AjaxResult.error("缺少参数");
+        }
+        LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
+        return tWarehousebillsService.cannibalize(tWarehouseBills, loginUser);
+    }
+
+}

+ 16 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/reportManagement/TWhgenlegController.java

@@ -14,6 +14,7 @@ import com.ruoyi.reportManagement.domain.TWhgenleg;
 import com.ruoyi.reportManagement.dto.TWarehousebill;
 import com.ruoyi.reportManagement.excel.Whgenleg;
 import com.ruoyi.reportManagement.service.ITWhgenlegService;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
 import com.ruoyi.warehouseBusiness.service.ITWarehouseBillsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -212,6 +213,21 @@ public class TWhgenlegController extends BaseController {
         List<Map<String, Object>> list = tWhgenlegService.selectdetailedList(tWarehousebill);
         return getDataTable(list);
     }
+    /**
+     * 获取库存总账详细信息
+     */
+    @PostMapping("/getTWhGenLeg")
+    public AjaxResult getTWhGenLeg(@RequestBody TWhgenleg tWhgenleg) {
+        if (tWhgenleg == null) {
+            return AjaxResult.error("未获取到库存信息");
+        }
+        TWhgenleg tWhGenLeg = tWhgenlegService.getTWhGenLeg(tWhgenleg);
+        if (tWhGenLeg == null){
+            return AjaxResult.error("供应商在当前库区无库存");
+        }else {
+            return AjaxResult.success(tWhGenLeg);
+        }
+    }
 
 
 

+ 66 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/anpin/InventoryLedgerExcel.java

@@ -74,6 +74,18 @@ public class InventoryLedgerExcel {
     //结余金额
     @Excel(name = "结余金额")
     private BigDecimal fAfterAmount;
+    //调入数量
+    private BigDecimal foldQty;
+    //调入单价
+    private BigDecimal foldUnitprice;
+    //调入金额
+    private BigDecimal foldAmount;
+    //调出数量
+    private BigDecimal calloutQty;
+    //调出单价
+    private BigDecimal calloutUnitprice;
+    //调出金额
+    private BigDecimal calloutAmount;
 
     public String getFyears() {
         return fyears;
@@ -259,6 +271,54 @@ public class InventoryLedgerExcel {
         this.fAfterAmount = fAfterAmount;
     }
 
+    public BigDecimal getFoldQty() {
+        return foldQty;
+    }
+
+    public void setFoldQty(BigDecimal foldQty) {
+        this.foldQty = foldQty;
+    }
+
+    public BigDecimal getFoldUnitprice() {
+        return foldUnitprice;
+    }
+
+    public void setFoldUnitprice(BigDecimal foldUnitprice) {
+        this.foldUnitprice = foldUnitprice;
+    }
+
+    public BigDecimal getFoldAmount() {
+        return foldAmount;
+    }
+
+    public void setFoldAmount(BigDecimal foldAmount) {
+        this.foldAmount = foldAmount;
+    }
+
+    public BigDecimal getCalloutQty() {
+        return calloutQty;
+    }
+
+    public void setCalloutQty(BigDecimal calloutQty) {
+        this.calloutQty = calloutQty;
+    }
+
+    public BigDecimal getCalloutUnitprice() {
+        return calloutUnitprice;
+    }
+
+    public void setCalloutUnitprice(BigDecimal calloutUnitprice) {
+        this.calloutUnitprice = calloutUnitprice;
+    }
+
+    public BigDecimal getCalloutAmount() {
+        return calloutAmount;
+    }
+
+    public void setCalloutAmount(BigDecimal calloutAmount) {
+        this.calloutAmount = calloutAmount;
+    }
+
     @Override
     public String toString() {
         return "InventoryLedgerExcel{" +
@@ -285,6 +345,12 @@ public class InventoryLedgerExcel {
                 ", fAfterQty=" + fAfterQty +
                 ", fAfterUnitprice=" + fAfterUnitprice +
                 ", fAfterAmount=" + fAfterAmount +
+                ", foldQty=" + foldQty +
+                ", foldUnitprice=" + foldUnitprice +
+                ", foldAmount=" + foldAmount +
+                ", calloutQty=" + calloutQty +
+                ", calloutUnitprice=" + calloutUnitprice +
+                ", calloutAmount=" + calloutAmount +
                 '}';
     }
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/mapper/TWhgenlegMapper.java

@@ -108,4 +108,11 @@ public interface TWhgenlegMapper {
      * @return
      */
     List<Map<String, Object>> selectStorageFeeItemList(@Param("warehouse") TWarehouseBills tWarehouseBills);
+    /**
+     * 查询库存总账列表
+     *
+     * @param tWhgenleg 库存总账
+     * @return 库存总账集合
+     */
+    public TWhgenleg getTWhGenLeg(TWhgenleg tWhgenleg);
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/ITWhgenlegService.java

@@ -118,4 +118,11 @@ public interface ITWhgenlegService {
      * @return
      */
     public List<SingleAnalysisFeesExcel> selectSingleAnalysisFees(SingleAnalysisExcel singleAnalysisExcel);
+    /**
+     * 查询库存总账列表
+     *
+     * @param tWhgenleg 库存总账
+     * @return 库存总账集合
+     */
+    public TWhgenleg getTWhGenLeg(TWhgenleg tWhgenleg);
 }

+ 5 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/reportManagement/service/impl/TWhgenlegServiceImpl.java

@@ -390,6 +390,11 @@ public class TWhgenlegServiceImpl implements ITWhgenlegService {
         return tWarehouseBillsMapper.selectSingleAnalysisFees(singleAnalysisExcel);
     }
 
+    @Override
+    public TWhgenleg getTWhGenLeg(TWhgenleg tWhgenleg) {
+        return tWhgenlegMapper.getTWhGenLeg(tWhgenleg);
+    }
+
     /**
      *
      * @param fOriginalbilldate 根据该字段进行合并

+ 56 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehouseBills.java

@@ -539,6 +539,17 @@ public class TWarehouseBills extends BaseEntity {
     /** 拒绝理由 */
     @Excel(name = "拒绝理由")
     private String fReason;
+    /** 调出仓库 */
+    @Excel(name = "调入仓库")
+    private Long fAllotWarehouseid;
+
+    /** 调出项目名,存储id 显示名称	t_goods 中的no或 name,模糊查找选择后,存储f_id,显示name */
+    @Excel(name = "调入项目名,存储id 显示名称	t_goods 中的no或 name,模糊查找选择后,存储f_id,显示name")
+    private Long fProject;
+    /** 调出仓库 */
+    private String fAllotWarehouseName;
+    /** 调出项目名,*/
+    private String fProjectName;
 
     //起运港中文名
     private String loadportidName;
@@ -635,6 +646,32 @@ public class TWarehouseBills extends BaseEntity {
     //开票公司联系人
     private String manage;
 
+    private String fWarehouseidName;
+
+    public String getfWarehouseidName() {
+        return fWarehouseidName;
+    }
+
+    public void setfWarehouseidName(String fWarehouseidName) {
+        this.fWarehouseidName = fWarehouseidName;
+    }
+
+    public String getfAllotWarehouseName() {
+        return fAllotWarehouseName;
+    }
+
+    public void setfAllotWarehouseName(String fAllotWarehouseName) {
+        this.fAllotWarehouseName = fAllotWarehouseName;
+    }
+
+    public String getfProjectName() {
+        return fProjectName;
+    }
+
+    public void setfProjectName(String fProjectName) {
+        this.fProjectName = fProjectName;
+    }
+
     public String getManage() {
         return manage;
     }
@@ -1776,7 +1813,24 @@ public class TWarehouseBills extends BaseEntity {
     public Integer getfPurchase() {
         return fPurchase;
     }
+    public void setfAllotWarehouseid(Long fAllotWarehouseid)
+    {
+        this.fAllotWarehouseid = fAllotWarehouseid;
+    }
 
+    public Long getfAllotWarehouseid()
+    {
+        return fAllotWarehouseid;
+    }
+    public void setfProject(Long fProject)
+    {
+        this.fProject = fProject;
+    }
+
+    public Long getfProject()
+    {
+        return fProject;
+    }
     @Override
     public String toString() {
         return "TWarehouseBills{" +
@@ -1897,6 +1951,8 @@ public class TWarehouseBills extends BaseEntity {
                 ", freeContainerDate=" + freeContainerDate +
                 ", fTakeOrders=" + fTakeOrders +
                 ", fReason=" + fReason +
+                ", fAllotWarehouseid=" + fAllotWarehouseid +
+                ", fProject=" + fProject +
                 '}';
     }
 }

+ 58 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java

@@ -301,6 +301,9 @@ public class TWarehousebillsfees extends BaseEntity {
     /** 存储环境(冷冻,常温 字典表) */
     @Excel(name = "存储环境(冷冻,常温 字典表)")
     private Integer fStoreEnv;
+    /** 调出库区 */
+    @Excel(name = "调出库区")
+    private Long fAllotWarehouseid;
     //环境中文名
     private String fStoreEnvName;
 
@@ -346,6 +349,52 @@ public class TWarehousebillsfees extends BaseEntity {
     private List<String> cLoadDate;
     //项目id
     private Long fGoodsid;
+    private String fAllotWarehouseName;
+
+    public String getfAllotWarehouseName() {
+        return fAllotWarehouseName;
+    }
+
+    public void setfAllotWarehouseName(String fAllotWarehouseName) {
+        this.fAllotWarehouseName = fAllotWarehouseName;
+    }
+
+    /**
+     * 结余数量
+     */
+    private BigDecimal fGrossweightblc;
+    /**
+     * 结余单价
+     */
+    private BigDecimal fVolumnblc;
+    /**
+     * 结余金额
+     */
+    private BigDecimal fNetweightblc;
+
+    public BigDecimal getfGrossweightblc() {
+        return fGrossweightblc;
+    }
+
+    public void setfGrossweightblc(BigDecimal fGrossweightblc) {
+        this.fGrossweightblc = fGrossweightblc;
+    }
+
+    public BigDecimal getfVolumnblc() {
+        return fVolumnblc;
+    }
+
+    public void setfVolumnblc(BigDecimal fVolumnblc) {
+        this.fVolumnblc = fVolumnblc;
+    }
+
+    public BigDecimal getfNetweightblc() {
+        return fNetweightblc;
+    }
+
+    public void setfNetweightblc(BigDecimal fNetweightblc) {
+        this.fNetweightblc = fNetweightblc;
+    }
 
     public Long getfGoodsid() {
         return fGoodsid;
@@ -894,7 +943,15 @@ public class TWarehousebillsfees extends BaseEntity {
     public void setfIsfilles(Integer fIsfilles) {
         this.fIsfilles = fIsfilles;
     }
+    public void setfAllotWarehouseid(Long fAllotWarehouseid)
+    {
+        this.fAllotWarehouseid = fAllotWarehouseid;
+    }
 
+    public Long getfAllotWarehouseid()
+    {
+        return fAllotWarehouseid;
+    }
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -951,6 +1008,7 @@ public class TWarehousebillsfees extends BaseEntity {
                 .append("fUnits", getfUnits())
                 .append("fStoreEnv", getfStoreEnv())
                 .append("fIsfilles", getfIsfilles())
+                .append("fAllotWarehouseid", getfAllotWarehouseid())
                 .toString();
     }
 }

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehouseBillsMapper.java

@@ -224,4 +224,11 @@ public interface TWarehouseBillsMapper extends BaseMapper<TWarehouseBills> {
      * @return 详情主表
      */
     public TWarehouseBills selectAnPinById(Long fId);
+    /**
+     * 查询调拨主表列表
+     *
+     * @param tWarehousebills 详情主表
+     * @return 详情主表集合
+     */
+    public List<TWarehouseBills> cannibalizeList(TWarehouseBills tWarehousebills);
 }

+ 19 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/mapper/TWarehousebillsfeesMapper.java

@@ -211,4 +211,23 @@ public interface TWarehousebillsfeesMapper extends BaseMapper<TWarehousebillsfee
      * @return
      */
     public List<PurchaseRequestExcel> purchaseRequest(TWarehouseBills tWarehouseBills);
+    /**
+     * 安品查询仓库调拨明细列表
+     *
+     * @param tWarehousebillsfees 仓库费用明细
+     * @return 仓库费用明细集合
+     */
+    public List<TWarehousebillsfees> anPinAllotList(TWarehousebillsfees tWarehousebillsfees);
+    /**
+     * 安品调入库统计
+     * @param tWarehousebillsfees
+     * @return
+     */
+    public List<WarhousrExcel> selectTWarehouseFold(TWarehousebillsfees tWarehousebillsfees);
+    /**
+     * 安品调出库统计
+     * @param tWarehousebillsfees
+     * @return
+     */
+    public List<WarhousrExcel> selectTWarehouseCallout(TWarehousebillsfees tWarehousebillsfees);
 }

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseBillsService.java

@@ -521,4 +521,19 @@ public interface ITWarehouseBillsService {
      * @return
      */
     public List<AnPingOrderMessage> selectFeeMessage(TWarehouseBills tWarehouseBills);
+
+    /**
+     * 安品调拨
+     * @param tWarehouseBills
+     * @param loginUser
+     * @return
+     */
+    public AjaxResult cannibalize(TWarehouseBills tWarehouseBills,LoginUser loginUser);
+
+    /**
+     * 安品调拨列表
+     * @param tWarehouseBills
+     * @return
+     */
+    public  List<TWarehouseBills> cannibalizeList(TWarehouseBills tWarehouseBills);
 }

+ 2 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/BillnoSerialServiceImpl.java

@@ -119,6 +119,8 @@ public class BillnoSerialServiceImpl implements IBillnoSerialService {
             billNo = "CK" + billNo;
         }else if ("XS".equals(billType)) {
             billNo = "XS" + billNo;
+        }else if ("DB".equals(billType)) {
+            billNo = "DB" + billNo;
         }else if ("SQFP".equals(billType)) {
             billNo = "SQFP" + billNo;
         }else if ("XXFP".equals(billType)) {

+ 147 - 15
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -1959,7 +1959,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         TWarehousebillsfees tWareHouseFees = new TWarehousebillsfees();
         tWareHouseFees.setfPid(fId);
         tWareHouseFees.setDelFlag("0");
-        List<TWarehousebillsfees> tWarehousebillsfees = tWarehousebillsfeesMapper.anPinTWarehousebillsfeesList(tWareHouseFees);
+        List<TWarehousebillsfees> tWarehousebillsfees = tWarehousebillsfeesMapper.anPinAllotList(tWareHouseFees);
         map.put("warehouseBills",warehouseBills);
         map.put("tWarehousebillsfees",tWarehousebillsfees);
         return map;
@@ -2124,7 +2124,24 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     @Override
     public List<WarhousrExcel> selectTWarehouseInorOut(TWarehousebillsfees tWarehousebillsfees) {
-        return tWarehousebillsfeesMapper.selectTWarehouseInorOut(tWarehousebillsfees);
+        List<WarhousrExcel> list = new ArrayList<>();
+        if (StringUtils.isEmpty(tWarehousebillsfees.getfBilltype())){
+            List<WarhousrExcel> excels = tWarehousebillsfeesMapper.selectTWarehouseInorOut(tWarehousebillsfees);
+            List<WarhousrExcel> warhousrExcels = tWarehousebillsfeesMapper.selectTWarehouseFold(tWarehousebillsfees);
+            List<WarhousrExcel> warhousrExcelList = tWarehousebillsfeesMapper.selectTWarehouseCallout(tWarehousebillsfees);
+            list.addAll(excels);
+            list.addAll(warhousrExcels);
+            list.addAll(warhousrExcelList);
+            return list;
+        }
+        if (tWarehousebillsfees.getfBilltype().equals("RK") || tWarehousebillsfees.getfBilltype().equals("CK")){
+            list = tWarehousebillsfeesMapper.selectTWarehouseInorOut(tWarehousebillsfees);
+        }else if (tWarehousebillsfees.getfBilltype().equals("DR")){
+            list = tWarehousebillsfeesMapper.selectTWarehouseFold(tWarehousebillsfees);
+        }else if (tWarehousebillsfees.getfBilltype().equals("DC")){
+            list = tWarehousebillsfeesMapper.selectTWarehouseCallout(tWarehousebillsfees);
+        }
+        return list;
     }
 
     @Override
@@ -2158,6 +2175,110 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         return tWarehousebillsfeesMapper.selectFeeMessage(tWarehouseBills,aLong.toString());
     }
 
+    @Override
+    @Transactional
+    public AjaxResult cannibalize(TWarehouseBills tWarehouseBills, LoginUser loginUser) {
+        String billType = null;//业务类型
+        Long billStatus = null;//状态
+        //查询调拨详情
+        TWarehouseBills warehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(tWarehouseBills.getfId());
+        if (warehouseBills == null){
+            return AjaxResult.error("数据不存在");
+        }
+        TWarehousebillsfees tWarehousebillsfees = new TWarehousebillsfees();
+        tWarehousebillsfees.setfPid(tWarehouseBills.getfId());
+        tWarehousebillsfees.setDelFlag("0");
+        List<TWarehousebillsfees> warehousebillsfees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesList(tWarehousebillsfees);
+        if (tWarehouseBills.getfTypeid() == 1){//调拨提较
+            if (warehouseBills.getfBillstatus().longValue() == 4
+            ||warehouseBills.getfBillstatus().longValue() == 5
+            ||warehouseBills.getfBillstatus().longValue() == 6){
+                return AjaxResult.error("已调拨确认,请勿重复操作!");
+            }
+            billStatus = 6L;
+            tWarehouseBills.setfReviewDate(new Date());
+            billType = "CK";
+        }else if (tWarehouseBills.getfTypeid() ==2){//撤销调拨
+            if (warehouseBills.getfBillstatus().longValue() != 6){
+                return AjaxResult.error("未调拨确认,无需撤销调拨!");
+            }
+            billStatus = 2L;
+            tWarehouseBills.setfReviewDate(null);
+            billType = "CKRevoke";
+        }else {
+            return AjaxResult.error("请选择操作类型");
+        }
+        if (CollectionUtils.isNotEmpty(warehousebillsfees)){
+            for (TWarehousebillsfees warehousebillsfee : warehousebillsfees) {
+                TWarehousebillsfees wareHouse = new TWarehousebillsfees();
+                wareHouse.setfId(warehousebillsfee.getfId());
+                warehouseBills.setfCorpid(warehousebillsfee.getfCorpid());
+                TWhgenleg tWhgenleg = this.anPinQueryTWhgenleg(warehouseBills, warehousebillsfee);
+                if (tWhgenleg == null){
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存不足");
+                }
+                if (tWhgenleg.getfGrossweightblc().compareTo(warehousebillsfee.getfQty())< 0){
+                    TFees tFees = tFeesMapper.selectTFeesById(warehousebillsfee.getfFeeid());
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存不足,当前"+tFees.getfName()+"库存为:"+ tWhgenleg.getfGrossweightblc());
+                }
+                if (billType.equals("CK")){
+                    //先给原经销商和库区减去
+                    this.anPinUpdateTWhgenlegData(warehousebillsfee,tWhgenleg.getfId(),billType);
+                    //在给现经销商和库区加上
+                    warehousebillsfee.setfWarehouseid(warehousebillsfee.getfAllotWarehouseid());
+                    warehouseBills.setfWarehouseid(warehouseBills.getfAllotWarehouseid());
+                    TWhgenleg whgenleg = this.anPinQueryTWhgenleg(warehouseBills, warehousebillsfee);
+                    if (whgenleg == null){
+                        this.anPinInstalTWhgenleg(warehouseBills,warehousebillsfee,loginUser.getUser());
+                    }else {
+                        this.anPinUpdateTWhgenlegData(warehousebillsfee,whgenleg.getfId(),"RK");
+                    }
+                }else if (billType.equals("CKRevoke")){
+                    //先给原经销商库区加上撤销出库
+                    TWhgenleg leg = this.anPinQueryTWhgenleg(warehouseBills, warehousebillsfee);
+                    if (leg == null){
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足");
+                    }
+                    if (leg.getfGrossweightblc().compareTo(warehousebillsfee.getfQty())< 0){
+                        TFees tFees = tFeesMapper.selectTFeesById(warehousebillsfee.getfFeeid());
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足,当前"+tFees.getfName()+"库存为:"+ tWhgenleg.getfGrossweightblc());
+                    }
+                    this.anPinUpdateTWhgenlegData(warehousebillsfee,tWhgenleg.getfId(),billType);
+                    //在给调入的经销商库区减去
+                    warehousebillsfee.setfWarehouseid(warehousebillsfee.getfAllotWarehouseid());
+                    warehouseBills.setfWarehouseid(warehouseBills.getfAllotWarehouseid());
+                    TWhgenleg whgenleg = this.anPinQueryTWhgenleg(warehouseBills, warehousebillsfee);
+                    if (whgenleg == null){
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足");
+                    }
+                    if (whgenleg.getfGrossweightblc().compareTo(warehousebillsfee.getfQty())< 0){
+                        TFees tFees = tFeesMapper.selectTFeesById(warehousebillsfee.getfFeeid());
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足,当前"+tFees.getfName()+"库存为:"+ tWhgenleg.getfGrossweightblc());
+                    }
+                    this.anPinUpdateTWhgenlegData(warehousebillsfee,whgenleg.getfId(),"CK");
+
+                }
+                wareHouse.setfBillstatus(billStatus);
+                tWarehousebillsfeesMapper.updateTWarehousebillsfees(wareHouse);
+
+            }
+        }
+        tWarehouseBills.setfBillstatus(billStatus);
+        tWarehouseBillsMapper.updateKaHeOrder(tWarehouseBills);
+        return AjaxResult.success();
+    }
+
+    @Override
+    public List<TWarehouseBills> cannibalizeList(TWarehouseBills tWarehouseBills) {
+        return tWarehouseBillsMapper.cannibalizeList(tWarehouseBills);
+    }
+
     /**
      * app仓储新行提交业务
      *
@@ -4066,7 +4187,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 for (TWarehousebillsfees warehousebillsfees : tWarehousebillsfeesList) {
                     TWhgenleg tWhgenleg = this.anPinQueryTWhgenleg(tWarehousebills, warehousebillsfees);
                     if (tWhgenleg == null){
-                        continue;
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足");
+                    }
+                    if (tWhgenleg.getfGrossweightblc().compareTo(warehousebillsfees.getfQty())< 0){
+                        TFees tFees = tFeesMapper.selectTFeesById(warehousebillsfees.getfFeeid());
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存不足,当前"+tFees.getfName()+"库存为:"+ tWhgenleg.getfGrossweightblc());
                     }
                     int updateTWhgenlegData = this.anPinUpdateTWhgenlegData(warehousebillsfees, tWhgenleg.getfId(), billsType);
                     if (updateTWhgenlegData < 1){
@@ -4517,18 +4644,23 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
     //判断入库属性是否为空
     public AjaxResult goodsAttribute(TWarehousebillsfees tWarehousebillsfees, String billsType){
-        if (tWarehousebillsfees.getfFeeid() == null){
-            return AjaxResult.error("品名不能为空");
-        }else if (tWarehousebillsfees.getfQty() == null){
-            return AjaxResult.error("数量不能为空");
-        }else if (tWarehousebillsfees.getfUnitprice() == null){
-            return AjaxResult.error("单价不能为空");
-        }else if (tWarehousebillsfees.getfFeeunitid() == null){
-            return AjaxResult.error("计价单位不能为空");
-        }else if (tWarehousebillsfees.getfWarehouseid() == null && billsType.equals("RK")){
-            return AjaxResult.error("库区不能为空");
-        }else if (tWarehousebillsfees.getfWarehouseid() == null && billsType.equals("CK")){
-            return AjaxResult.error("库区不能为空");
+        if ("SQ".equals(billsType) || "CK".equals(billsType)
+                || "RK".equals(billsType) || "XS".equals(billsType)) {
+            if (tWarehousebillsfees.getfFeeid() == null) {
+                return AjaxResult.error("品名不能为空");
+            } else if (tWarehousebillsfees.getfQty() == null) {
+                return AjaxResult.error("数量不能为空");
+            } else if (tWarehousebillsfees.getfUnitprice() == null) {
+                return AjaxResult.error("单价不能为空");
+            } else if (tWarehousebillsfees.getfFeeunitid() == null) {
+                return AjaxResult.error("计价单位不能为空");
+            } else if (tWarehousebillsfees.getfWarehouseid() == null && billsType.equals("RK")) {
+                return AjaxResult.error("库区不能为空");
+            } else if (tWarehousebillsfees.getfWarehouseid() == null && billsType.equals("CK")) {
+                return AjaxResult.error("库区不能为空");
+            } else {
+                return AjaxResult.success();
+            }
         }else {
             return AjaxResult.success();
         }

+ 22 - 0
ruoyi-warehouse/src/main/resources/mapper/reportManagement/TWhgenlegMapper.xml

@@ -42,6 +42,7 @@
         <result property="remark" column="remark"/>
         <result property="fBusinessType" column="f_business_type"/>
         <result property="fOriginalbilldate" column="f_originalbilldate"/>
+        <result property="fVolumnblc" column="f_volumnblc"/>
     </resultMap>
 
     <sql id="selectTWhgenlegVo">
@@ -642,5 +643,26 @@
             </if>
         </where>
     </select>
+    <select id="getTWhGenLeg" parameterType="TWhgenleg" resultMap="TWhgenlegResult">
+        select
+        ware.f_id,
+        ware.f_corpid,
+        ware.f_warehouse_locationid,
+        ware.f_goodsid,
+        ware.f_billingway,
+        IFNULL(ware.f_grossweightblc,0) AS f_grossweightblc,
+        IFNULL(ware.f_volumnblc,0) AS f_volumnblc,
+        IFNULL(ware.f_netweightblc,0) AS f_netweightblc
+        from
+        t_whgenleg ware
+        left join sys_user u on ware.create_by = u.user_name
+        left join sys_dept d on u.dept_id = d.dept_id
+        <where>
+            <if test="fCorpid != null ">and ware.f_corpid = #{fCorpid}</if>
+            <if test="fWarehouseLocationid != null ">and ware.f_warehouse_locationid = #{fWarehouseLocationid}</if>
+            <if test="fBillingway != null ">and ware.f_billingway = #{fBillingway}</if>
+            <if test="fGoodsid != null ">and ware.f_goodsid = #{fGoodsid}</if>
+        </where>
+    </select>
 
 </mapper>

+ 289 - 5
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -101,6 +101,8 @@
         <result property="fPrint"    column="f_print"    />
         <result property="fTakeOrders"    column="f_take_orders"    />
         <result property="fReason"    column="f_reason"    />
+        <result property="fAllotWarehouseid"    column="f_allot_warehouseid"    />
+        <result property="fProject"    column="f_project"    />
     </resultMap>
     <sql id="selectTWarehousebillsVo">
         select f_id,
@@ -198,7 +200,9 @@
                f_print_log,
                f_print,
                f_take_orders,
-               f_reason
+               f_reason,
+               f_allot_warehouseid,
+               f_project
         from t_warehousebills
     </sql>
 
@@ -607,6 +611,7 @@
                tw.f_stltypeid,
                tw.f_bscorpno,
                tw.f_warehouseid,
+               th.f_name AS fWarehouseidName,
                tw.f_storekeeper,
                sy.user_name AS fStorekeeperName,
                tw.f_chargedate,
@@ -698,7 +703,11 @@
                tw.f_print_log,
                tw.f_print,
                tw.f_take_orders,
-               tw.f_reason
+               tw.f_reason,
+               tw.f_allot_warehouseid,
+               tw.f_project,
+               tj.f_name AS fProjectName,
+               th.f_name AS fAllotWarehouseName
         FROM t_warehousebills tw
                  LEFT JOIN t_project tp ON tw.f_goodsid = tp.f_id
                  LEFT JOIN t_corps tc ON tp.f_corpid = tc.f_id
@@ -707,6 +716,9 @@
                  LEFT JOIN sys_user su ON su.user_id = tp.f_person
                  LEFT JOIN sys_user sr ON sr.user_id = tw.f_purchase
                  LEFT JOIN sys_user sy ON sy.user_id = tw.f_storekeeper
+                 LEFT JOIN t_project tj ON tw.f_project = tj.f_id
+                 LEFT JOIN t_warehouse th ON tw.f_allot_warehouseid = th.f_id
+                 LEFT JOIN t_warehouse te ON tw.f_warehouseid = te.f_id
         where tw.f_id = #{fId}
         ORDER BY f_bsdate desc
     </select>
@@ -1040,6 +1052,8 @@
             <if test="fPrint != null">f_print,</if>
             <if test="fTakeOrders != null">f_take_orders,</if>
             <if test="fReason != null">f_reason,</if>
+            <if test="fAllotWarehouseid != null">f_allot_warehouseid,</if>
+            <if test="fProject != null">f_project,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fBillno != null">#{fBillno},</if>
@@ -1138,6 +1152,8 @@
             <if test="fPrint != null">#{fPrint},</if>
             <if test="fTakeOrders != null">#{fTakeOrders},</if>
             <if test="fReason != null">#{fReason},</if>
+            <if test="fAllotWarehouseid != null">#{fAllotWarehouseid},</if>
+            <if test="fProject != null">#{fProject},</if>
         </trim>
     </insert>
 
@@ -1239,6 +1255,8 @@
             <if test="fPrint != null">f_print = #{fPrint},</if>
             <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
             <if test="fReason != null">f_reason = #{fReason},</if>
+            <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
+            <if test="fProject != null">f_project = #{fProject},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -1292,8 +1310,8 @@
             <if test="remark != null">remark = #{remark},</if>
             <if test="fBillingDeadline != null">f_billing_deadline = #{fBillingDeadline},</if>
             <if test="fProductName != null">f_product_name = #{fProductName},</if>
-            <if test="fReviewDate != null and fBillstatus == 11">f_review_date = #{fReviewDate},</if>
-            <if test="fReviewDate != null and fBillstatus != 11">f_review_date = null,</if>
+            <if test="fReviewDate != null and fBillstatus == 6">f_review_date = #{fReviewDate},</if>
+            <if test="fReviewDate != null and fBillstatus != 6">f_review_date = null,</if>
             <if test="fTruckno != null">f_truckno = #{fTruckno},</if>
             <if test="fDriverName != null">f_driver_name = #{fDriverName},</if>
             <if test="fDriverTel != null">f_driver_tel = #{fDriverTel},</if>
@@ -1328,7 +1346,6 @@
             <if test="fVoyid != null">f_voyid = #{fVoyid},</if>
             <if test="fPaymode != null">f_paymode = #{fPaymode},</if>
             <if test="fLaneid != null">f_laneid = #{fLaneid},</if>
-            <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
             <if test="fMoney != null">f_money = #{fMoney},</if>
             <if test="fPurchase != null">f_purchase = #{fPurchase},</if>
             <if test="fCreateLog != null">f_create_log = #{fCreateLog},</if>
@@ -1336,6 +1353,8 @@
             <if test="fPrint != null">f_print = #{fPrint},</if>
             <if test="fTakeOrders != null">f_take_orders = #{fTakeOrders},</if>
             <if test="fReason != null">f_reason = #{fReason},</if>
+            <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
+            <if test="fProject != null">f_project = #{fProject},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -2628,5 +2647,270 @@
         <if test="fBillstatus != null and fBillstatus != 6">,f_audit_time = null</if>
         where f_pid = #{fPid}
     </update>
+    <select id="cannibalizeList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">
+        SELECT
+        DISTINCT
+        tw.f_id,
+        tw.f_billno,
+        tw.f_customsdeclartion,
+        tw.f_originalbillno,
+        tw.f_deptid,
+        tw.f_bsdeptid,
+        tw.f_contacts,
+        tw.f_tel,
+        tw.f_corpid,
+        tc.f_name AS corpName,
+        tw.f_tocorpid,
+        tw.f_stltypeid,
+        tw.f_bscorpno,
+        tw.f_warehouseid,
+        tw.f_storekeeper,
+        tw.f_chargedate,
+        tw.f_bsdate,
+        tw.f_planqty,
+        tw.f_plangrossweight,
+        tw.f_plannetweight,
+        tw.f_planvolumn,
+        tw.f_qty,
+        tw.f_grossweight,
+        tw.f_netweight,
+        tw.f_volumn,
+        tw.f_billingway,
+        tw.f_trademodeid,
+        tw.f_sbu,
+        tw.f_feetunit,
+        tw.f_mblno,
+        tw.f_marks,
+        tw.f_vslvoy,
+        tw.f_eta,
+        tw.f_customno,
+        tw.f_ifweigh,
+        tw.f_ifpledge,
+        tw.f_ifdamage,
+        tw.f_bankcorpid,
+        tw.f_billtype,
+        tw.f_billstatus,
+        CASE
+
+        WHEN tw.f_billstatus = '1' THEN
+        '保存'
+        WHEN tw.f_billstatus = '2' THEN
+        '暂存'
+        WHEN tw.f_billstatus = '3' THEN
+        '审批驳回'
+        WHEN tw.f_billstatus = '4' THEN
+        '提交审核'
+        WHEN tw.f_billstatus = '5' THEN
+        '审核中'
+        WHEN tw.f_billstatus = '6' THEN
+        '审核完成'
+        END AS fBillstatusName,
+        tw.f_items_status,
+        tw.del_flag,
+        tw.create_by,
+        tw.create_time,
+        tw.update_by,
+        tw.update_time,
+        tw.remark,
+        tw.f_billing_deadline,
+        tw.f_product_name,
+        tw.f_review_date,
+        tw.f_truckno,
+        tw.f_driver_name,
+        tw.f_driver_tel,
+        tw.f_driver_id_car,
+        tw.f_business_type,
+        tw.f_labour,
+        tw.f_fleet,
+        tw.f_inwarehouseid,
+        tw.f_bstime,
+        tw.f_cartype,
+        tw.f_goodsid,
+        tp.f_name AS projectName,
+        tw.f_new_trademodeid,
+        tw.f_loadportid,
+        tw.f_destportid,
+        tw.f_serviceitems,
+        tw.f_invoceobj,
+        tw.f_sign,
+        tw.f_detentioncargo,
+        tw.f_booksmarks,
+        tw.f_shippername,
+        tw.f_shipperattn,
+        tw.f_shippertel,
+        tw.f_consigneername,
+        tw.f_consigneeattn,
+        tw.f_consigneetel,
+        tw.f_insurance,
+        tw.f_insuranceamt,
+        tw.f_closedate,
+        tw.f_docmentdate,
+        tw.f_vslid,
+        tw.f_voyid,
+        tw.f_typeid,
+        tw.f_paymode,
+        tw.f_laneid,
+        tw.f_cntval,
+        tw.f_date_changed,
+        tw.f_market_number,
+        tw.f_money,
+        tw.f_teachers_weight,
+        tw.f_students_weight,
+        th.f_name AS fWarehouseName,
+        tw.f_market_typid,
+        tw.f_purchase,
+        tr.f_name    AS fsbuName,
+        tw.f_create_log,
+        tw.f_print_log,
+        tw.f_print,
+        tw.f_take_orders,
+        tw.f_reason,
+        CASE
+
+        WHEN f_take_orders = '0' THEN
+        '待接单'
+        WHEN f_take_orders = '1' THEN
+        '已接单'
+        WHEN f_take_orders = '2' THEN
+        '拒绝'
+        END AS fTakeOrdersName,
+        tw.f_allot_warehouseid,
+        tw.f_project,
+        tj.f_name AS fProjectName,
+        ts.f_name AS fAllotWarehouseName
+        FROM
+        t_warehousebills tw
+        LEFT JOIN t_project tp
+        ON tw.f_goodsid = tp.f_id
+        LEFT JOIN t_corps tc
+        ON tw.f_corpid = tc.f_id
+        LEFT JOIN t_corps tr
+        ON tr.f_id = tw.f_sbu
+        LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
+        LEFT JOIN t_warehousebillsfees tb ON tb.f_pid = tw.f_id
+        LEFT JOIN t_project tj ON tw.f_project = tj.f_id
+        LEFT JOIN t_warehouse ts ON tw.f_allot_warehouseid = ts.f_id
+        <where>
+            tw.del_flag = '0'
+            and tb.del_flag = '0'
+            <if test="fFeeid != null ">and tb.f_feeid = #{fFeeid}</if>
+            <if test="fBillno != null  and fBillno != ''">and tw.f_billno = #{fBillno}</if>
+            <if test="fCustomsdeclartion != null  and fCustomsdeclartion != ''">and tw.f_customsdeclartion =
+                #{fCustomsdeclartion}
+            </if>
+            <if test="fOriginalbillno != null  and fOriginalbillno != ''">and tw.f_originalbillno = #{fOriginalbillno}
+            </if>
+            <if test="fDeptid != null ">and tw.f_deptid = #{fDeptid}</if>
+            <if test="fBsdeptid != null ">and tw.f_bsdeptid = #{fBsdeptid}</if>
+            <if test="fContacts != null  and fContacts != ''">and tw.f_contacts = #{fContacts}</if>
+            <if test="fTel != null  and fTel != ''">and tw.f_tel = #{fTel}</if>
+            <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
+            <if test="fTocorpid != null ">and tw.f_tocorpid = #{fTocorpid}</if>
+            <if test="fStltypeid != null ">and tw.f_stltypeid = #{fStltypeid}</if>
+            <if test="fBscorpno != null  and fBscorpno != ''">and tw.f_bscorpno = #{fBscorpno}</if>
+            <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
+            <if test="fStorekeeper != null  and fStorekeeper != ''">and tw.f_storekeeper = #{fStorekeeper}</if>
+            <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
+            <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
+            <if test="fPlanqty != null ">and tw.f_planqty = #{fPlanqty}</if>
+            <if test="fPlangrossweight != null ">and tw.f_plangrossweight = #{fPlangrossweight}</if>
+            <if test="fPlannetweight != null ">and tw.f_plannetweight = #{fPlannetweight}</if>
+            <if test="fPlanvolumn != null ">and tw.f_planvolumn = #{fPlanvolumn}</if>
+            <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
+            <if test="fGrossweight != null ">and tw.f_grossweight = #{fGrossweight}</if>
+            <if test="fNetweight != null ">and tw.f_netweight = #{fNetweight}</if>
+            <if test="fVolumn != null ">and tw.f_volumn = #{fVolumn}</if>
+            <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
+            <if test="fTrademodeid != null ">and tw.f_trademodeid = #{fTrademodeid}</if>
+            <if test="fSbu != null ">and tw.f_sbu = #{fSbu}</if>
+            <if test="fFeetunit != null  and fFeetunit != ''">and tw.f_feetunit = #{fFeetunit}</if>
+            <if test="fMblno != null  and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
+            <if test="fMarks != null  and fMarks != ''">and tw.f_marks = #{fMarks}</if>
+            <if test="fVslvoy != null  and fVslvoy != ''">and tw.f_vslvoy = #{fVslvoy}</if>
+            <if test="fEta != null ">and tw.f_eta = #{fEta}</if>
+            <if test="fCustomno != null  and fCustomno != ''">and tw.f_customno = #{fCustomno}</if>
+            <if test="fIfweigh != null  and fIfweigh != ''">and tw.f_ifweigh = #{fIfweigh}</if>
+            <if test="fIfpledge != null  and fIfpledge != ''">and tw.f_ifpledge = #{fIfpledge}</if>
+            <if test="fIfdamage != null  and fIfdamage != ''">and tw.f_ifdamage = #{fIfdamage}</if>
+            <if test="fBankcorpid != null  and fBankcorpid != ''">and tw.f_bankcorpid = #{fBankcorpid}</if>
+            <if test="fBilltype != null  and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
+            <if test="fBillstatus != null ">and tw.f_billstatus = #{fBillstatus}</if>
+            <if test="fBillstatus != null and fBillstatus == 7">and tw.f_billstatus != '6'</if>
+            <if test="fItemsStatus != null ">and tw.f_items_status = #{fItemsStatus}</if>
+            <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
+            <if test="fProductName != null  and fProductName != ''">and tw.f_product_name like concat('%',
+                #{fProductName},
+                '%')
+            </if>
+            <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
+            <if test="fTruckno != null  and fTruckno != ''">and tw.f_truckno = #{fTruckno}</if>
+            <if test="fDriverName != null  and fDriverName != ''">and tw.f_driver_name like concat('%', #{fDriverName},
+                '%')
+            </if>
+            <if test="fDriverTel != null  and fDriverTel != ''">and tw.f_driver_tel = #{fDriverTel}</if>
+            <if test="fDriverIdCar != null  and fDriverIdCar != ''">and tw.f_driver_id_car = #{fDriverIdCar}</if>
+            <if test="fBusinessType != null  and fBusinessType != ''">and tw.f_business_type = #{fBusinessType}</if>
+            <if test="fLabour != null ">and tw.f_labour = #{fLabour}</if>
+            <if test="fFleet != null ">and tw.f_fleet = #{fFleet}</if>
+            <if test="fInwarehouseid != null ">and tw.f_inwarehouseid = #{fInwarehouseid}</if>
+            <if test="fBstime != null ">and tw.f_bstime = #{fBstime}</if>
+            <if test="fCartype != null ">and tw.f_cartype = #{fCartype}</if>
+            <if test="fGoodsid != null ">and tw.f_goodsid = #{fGoodsid}</if>
+            <if test="fNewTrademodeid != null ">and tw.f_new_trademodeid = #{fNewTrademodeid}</if>
+            <if test="fLoadportid != null ">and tw.f_loadportid = #{fLoadportid}</if>
+            <if test="fDestportid != null ">and tw.f_destportid = #{fDestportid}</if>
+            <if test="fServiceitems != null  and fServiceitems != ''">and tw.f_serviceitems = #{fServiceitems}</if>
+            <if test="fInvoceobj != null  and fInvoceobj != ''">and tw.f_invoceobj = #{fInvoceobj}</if>
+            <if test="fSign != null ">and tw.f_sign = #{fSign}</if>
+            <if test="fDetentioncargo != null ">and tw.f_detentioncargo = #{fDetentioncargo}</if>
+            <if test="fBooksmarks != null  and fBooksmarks != ''">and tw.f_booksmarks = #{fBooksmarks}</if>
+            <if test="fShippername != null  and fShippername != ''">and tw.f_shippername like concat('%',
+                #{fShippername},
+                '%')
+            </if>
+            <if test="fShipperattn != null  and fShipperattn != ''">and tw.f_shipperattn = #{fShipperattn}</if>
+            <if test="fShippertel != null  and fShippertel != ''">and tw.f_shippertel = #{fShippertel}</if>
+            <if test="fConsigneername != null  and fConsigneername != ''">and tw.f_consigneername like concat('%',
+                #{fConsigneername}, '%')
+            </if>
+            <if test="fConsigneeattn != null  and fConsigneeattn != ''">and tw.f_consigneeattn = #{fConsigneeattn}</if>
+            <if test="fConsigneetel != null  and fConsigneetel != ''">and tw.f_consigneetel = #{fConsigneetel}</if>
+            <if test="fInsurance != null  and fInsurance != ''">and tw.f_insurance = #{fInsurance}</if>
+            <if test="fInsuranceamt != null ">and tw.f_insuranceamt = #{fInsuranceamt}</if>
+            <if test="fClosedate != null ">and tw.f_closedate = #{fClosedate}</if>
+            <if test="fDocmentdate != null ">and tw.f_docmentdate = #{fDocmentdate}</if>
+            <if test="fVslid != null ">and tw.f_vslid = #{fVslid}</if>
+            <if test="fVoyid != null ">and tw.f_voyid = #{fVoyid}</if>
+            <if test="fTypeid != null ">and tw.f_typeid = #{fTypeid}</if>
+            <if test="fPaymode != null ">and tw.f_paymode = #{fPaymode}</if>
+            <if test="fLaneid != null ">and tw.f_laneid = #{fLaneid}</if>
+            <if test="fCntval != null  and fCntval != ''">and tw.f_cntval = #{fCntval}</if>
+            <if test="createBy != null  and createBy != ''">and tw.create_by = #{createBy}</if>
+            <if test="remark != null  and remark != ''">and tw.remark = #{remark}</if>
+            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+                and tw.create_time &gt;= #{cLoadDate[0]}
+            </if>
+            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+                and tw.create_time &lt;= #{cLoadDate[1]}
+            </if>
+            <if test='moneys != null and moneys[0] != null and moneys[0]!= ""'>
+                and tw.f_money &gt;= #{moneys[0]}
+            </if>
+            <if test='moneys != null and moneys[1] != null and moneys[1]!= ""'>
+                and tw.f_money &lt;= #{moneys[1]}
+            </if>
+            <if test='timeInterval != null and timeInterval[0] != null and timeInterval[0]!= ""'>
+                and tw.f_bsdate &gt;= #{timeInterval[0]}
+            </if>
+            <if test='timeInterval != null and timeInterval[1] != null and timeInterval[1]!= ""'>
+                and tw.f_bsdate &lt;= #{timeInterval[1]}
+            </if>
+            <if test="fTakeOrders != null "> and tw.f_take_orders = #{fTakeOrders}</if>
+            <if test="fReason != null  and fReason != ''"> and tw.f_reason = #{fReason}</if>
+            <if test="fAllotWarehouseid != null "> and tw.f_allot_warehouseid = #{fAllotWarehouseid}</if>
+            <if test="fProject != null "> and tw.f_project = #{fProject}</if>
+        </where>
+        ORDER BY tw.f_bsdate DESC,tw.f_id DESC
+    </select>
 
 </mapper>

+ 414 - 12
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsfeesMapper.xml

@@ -62,6 +62,7 @@
         <result property="fUnits" column="f_units"/>
         <result property="fStoreEnv" column="f_store_env"/>
         <result property="fIsfilles" column="f_isfilles"/>
+        <result property="fAllotWarehouseid"    column="f_allot_warehouseid"    />
     </resultMap>
 
     <sql id="selectTWarehousebillsfeesVo">
@@ -121,7 +122,8 @@
                f_valid,
                f_units,
                f_store_env,
-               f_isfilles
+               f_isfilles,
+               f_allot_warehouseid
         from t_warehousebillsfees
     </sql>
 
@@ -341,6 +343,7 @@
             <if test="fUnits != null">f_units,</if>
             <if test="fStoreEnv != null">f_store_env,</if>
             <if test="fIsfilles != null">f_isfilles,</if>
+            <if test="fAllotWarehouseid != null">f_allot_warehouseid,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fPid != null">#{fPid},</if>
@@ -399,6 +402,7 @@
             <if test="fUnits != null">#{fUnits},</if>
             <if test="fStoreEnv != null">#{fStoreEnv},</if>
             <if test="fIsfilles != null">#{fIsfilles},</if>
+            <if test="fAllotWarehouseid != null">#{fAllotWarehouseid},</if>
         </trim>
     </insert>
 
@@ -460,6 +464,7 @@
             <if test="fUnits != null">f_units = #{fUnits},</if>
             <if test="fStoreEnv != null">f_store_env = #{fStoreEnv},</if>
             <if test="fIsfilles != null">f_isfilles = #{fIsfilles},</if>
+            <if test="fAllotWarehouseid != null">f_allot_warehouseid = #{fAllotWarehouseid},</if>
         </trim>
         where f_id = #{fId}
     </update>
@@ -948,7 +953,8 @@
         tw.f_isfilles,
         si.dict_label AS fUnitsName,
         st.dict_label AS fStoreEnvName,
-        sti.dict_label AS fIsfillesName
+        sti.dict_label AS fIsfillesName,
+        tw.f_allot_warehouseid
         from t_warehousebillsfees tw
         LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
         LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
@@ -1031,6 +1037,8 @@
 
         WHEN tw.f_billtype = 'CK' THEN
         '出库'
+        WHEN tw.f_billtype = 'DB' THEN
+        '调拨'
         WHEN tw.f_billtype = 'RK' THEN
         '入库'
         END AS fBilltypeName,/*出入库类型*/
@@ -1381,21 +1389,21 @@
         /*库区*/
         th.f_warehouse_information AS fWarehouseName,
         /*库区中文名*/
-        ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum(
+        ifnull(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) - sum(
         CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ),0) AS fBeginQty,
         /*期初数量*/
         ROUND(
         IFNULL((
-        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) - sum(
+        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END )+ IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) - sum(
         CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ))/(
-        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) - sum( CASE
+        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END ) + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 )  - sum( CASE
         WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_qty ELSE 0 END )),
         0
         ),
         2
         ) AS fBeginUnitprice,
         /*期初单价*/
-        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ) -
+        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END )+ IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) -
         sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;#{timeInterval[0]} THEN tf.f_amount ELSE 0 END ),0) AS
         fBeginAmount,
         /*期初金额*/
@@ -1411,25 +1419,35 @@
         IFNULL(sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&gt;=#{timeInterval[0]} AND tf.f_bsdate&lt;=#{timeInterval[1]}
         THEN tf.f_amount ELSE 0 END ),0) AS cfAmount,
         /*出库金额*/
-        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) -
+        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) + IFNULL( dr.fQty, 0 ) - IFNULL( dc.fQty, 0 )  + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) -
         sum( CASE WHEN tf.f_billtype = 'CK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END ),0) AS
         fAfterQty,
         /*结余数量*/
         ROUND(
         IFNULL((
-        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) - sum(
+        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) + IFNULL( dr.fAmount, 0 )- IFNULL( dc.fAmount, 0 ) + IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 ) - sum(
         CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_amount ELSE 0 END ))/(
-        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;= #{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) - sum( CASE
+        sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;= #{timeInterval[1]} THEN tf.f_qty ELSE 0 END ) + IFNULL( dr.fQty, 0 ) - IFNULL( dc.fQty, 0 )  + IFNULL( de.fQty, 0 ) - IFNULL( df.fQty, 0 ) - sum( CASE
         WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;=#{timeInterval[1]} THEN tf.f_qty ELSE 0 END )),
         0
         ),
         2
         ) AS fAfterUnitprice,
         /*结余单价*/
-        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END ) -
+        IFNULL(sum( CASE WHEN tf.f_billtype='RK' AND tf.f_bsdate&lt;= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END )+ IFNULL( dr.fAmount, 0 ) - IFNULL( dc.fAmount, 0 ) + IFNULL( de.fAmount, 0 )- IFNULL( df.fAmount, 0 )-
         sum( CASE WHEN tf.f_billtype='CK' AND tf.f_bsdate&lt;= #{timeInterval[1]} THEN tf.f_amount ELSE 0 END ),0) AS
-        fAfterAmount /*结余金额*/
-
+        fAfterAmount, /*结余金额*/
+        IFNULL( dr.fQty, 0 ) AS foldQty,
+        /*调入数量*/
+        IFNULL( dr.fUnitprice, 0 ) AS foldUnitprice,
+        /*调入单价*/
+        IFNULL( dr.fAmount, 0 ) AS foldAmount,
+        /*调入金额*/
+        IFNULL( dc.fQty, 0 ) AS calloutQty,
+        /*调出数量*/
+        IFNULL( dc.fUnitprice, 0 ) AS calloutUnitprice,
+        /*调出单价*/
+        IFNULL( dc.fAmount, 0 ) AS calloutAmount /*调出金额*/
         FROM
         t_warehousebillsfees tf
         LEFT JOIN t_warehousebills tw ON tf.f_pid = tw.f_id
@@ -1440,6 +1458,97 @@
         AND sc.dict_type = 'data_unitfees'
         LEFT JOIN sys_dict_data si ON si.dict_value = te.f_feetype
         AND si.dict_type = 'data_cost_attribute'
+        LEFT JOIN (
+        SELECT
+        tf.f_corpid fCorpid,
+        tf.f_feeid fFeeid,
+        tf.f_feeUnitid fFeeUnitid,
+        IFNULL(SUM(tf.f_qty),0) fQty,
+        IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
+        IFNULL(SUM(tf.f_amount),0) fAmount,
+        tf.f_allot_warehouseid fAllotWarehouseid
+        FROM
+        t_warehousebillsfees tf
+        LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
+        WHERE
+        tf.f_billtype = 'DB'
+        AND tf.del_flag = '0'
+        AND tw.f_billstatus = 6
+        AND tf.f_bsdate&gt;=#{timeInterval[0]}
+        AND tf.f_bsdate&lt;=#{timeInterval[1]}
+        GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_allot_warehouseid
+        ) dr ON tf.f_corpid = dr.fCorpid
+        AND tf.f_feeid = dr.fFeeid
+        AND tf.f_feeUnitid = dr.fFeeUnitid
+        AND tf.f_warehouseid = dr.fAllotWarehouseid
+        LEFT JOIN (
+        SELECT
+        tf.f_corpid fCorpid,
+        tf.f_feeid fFeeid,
+        tf.f_feeUnitid fFeeUnitid,
+        IFNULL(SUM(tf.f_qty),0) fQty,
+        IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
+        IFNULL(SUM(tf.f_amount),0) fAmount,
+        tf.f_warehouseid fwarehouseid
+        FROM
+        t_warehousebillsfees tf
+        LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
+        WHERE
+        tf.f_billtype = 'DB'
+        AND tf.del_flag = '0'
+        AND tw.f_billstatus = 6
+        AND tf.f_bsdate&gt;=#{timeInterval[0]}
+        AND tf.f_bsdate&lt;=#{timeInterval[1]}
+        GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_warehouseid
+        ) dc ON tf.f_corpid = dc.fCorpid
+        AND tf.f_feeid = dc.fFeeid
+        AND tf.f_feeUnitid = dc.fFeeUnitid
+        AND tf.f_warehouseid = dc.fwarehouseid
+
+        LEFT JOIN (
+        SELECT
+        tf.f_corpid fCorpid,
+        tf.f_feeid fFeeid,
+        tf.f_feeUnitid fFeeUnitid,
+        IFNULL(SUM(tf.f_qty),0) fQty,
+        IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
+        IFNULL(SUM(tf.f_amount),0) fAmount,
+        tf.f_allot_warehouseid fAllotWarehouseid
+        FROM
+        t_warehousebillsfees tf
+        LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
+        WHERE
+        tf.f_billtype = 'DB'
+        AND tf.del_flag = '0'
+        AND tw.f_billstatus = 6
+        AND tf.f_bsdate&lt;=#{timeInterval[0]}
+        GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_allot_warehouseid
+        ) de ON tf.f_corpid = de.fCorpid
+        AND tf.f_feeid = de.fFeeid
+        AND tf.f_feeUnitid = de.fFeeUnitid
+        AND tf.f_warehouseid = de.fAllotWarehouseid
+        LEFT JOIN (
+        SELECT
+        tf.f_corpid fCorpid,
+        tf.f_feeid fFeeid,
+        tf.f_feeUnitid fFeeUnitid,
+        IFNULL(SUM(tf.f_qty),0) fQty,
+        IFNULL(SUM(tf.f_unitprice),0) fUnitprice,
+        IFNULL(SUM(tf.f_amount),0) fAmount,
+        tf.f_warehouseid fwarehouseid
+        FROM
+        t_warehousebillsfees tf
+        LEFT JOIN t_warehousebills tw ON tw.f_id = tf.f_pid
+        WHERE
+        tf.f_billtype = 'DB'
+        AND tf.del_flag = '0'
+        AND tw.f_billstatus = 6
+        AND tf.f_bsdate&lt;=#{timeInterval[0]}
+        GROUP BY tf.f_corpid,tf.f_feeid,tf.f_feeUnitid,tf.f_warehouseid
+        ) df ON tf.f_corpid = df.fCorpid
+        AND tf.f_feeid = df.fFeeid
+        AND tf.f_feeUnitid = df.fFeeUnitid
+        AND tf.f_warehouseid = df.fwarehouseid
         WHERE
         tf.f_billtype IN ( 'RK', 'CK' )
         AND tf.del_flag = '0'
@@ -1669,5 +1778,298 @@
         </if>
         td.fCorpid DESC
     </select>
+    <select id="anPinAllotList" parameterType="TWarehousebillsfees"
+            resultMap="TWarehousebillsfeesResult">
+        select tw.f_id,
+        tw.f_pid,
+        tw.f_lineno,
+        tw.f_corpid,
+        tw.f_feeid,
+        tf.f_name AS feeName,
+        tf.f_currency AS fCurrencyName,
+        tw.f_feeUnitid,
+        sc.dict_label AS fFeeunitName,
+        tw.f_qty,
+        tw.f_unitprice,
+        tw.f_amount,
+        tw.f_currency,
+        tw.f_exrate,
+        tw.f_taxrate,
+        tw.f_dc,
+        tw.f_billstatus,
+        CASE
+
+        WHEN tw.f_billstatus = '1' THEN
+        '保存'
+        WHEN tw.f_billstatus = '2' THEN
+        '暂存'
+        WHEN tw.f_billstatus = '3' THEN
+        '审批驳回'
+        WHEN tw.f_billstatus = '4' THEN
+        '提交审核'
+        WHEN tw.f_billstatus = '5' THEN
+        '审核中'
+        WHEN tw.f_billstatus = '6' THEN
+        '审核完成'
+        END AS fBillstatusName,
+        tw.f_review_date,
+        tw.f_statement_no,
+        tw.f_accamount,
+        tw.f_stlamount,
+        tw.f_accamount_date,
+        tw.f_invnos,
+        tw.f_invamount,
+        tw.f_stlamount_no,
+        tw.f_askamount,
+        tw.f_status,
+        tw.f_stlamount_date,
+        tw.del_flag,
+        tw.create_by,
+        tw.create_time,
+        tw.update_by,
+        tw.update_time,
+        tw.remark,
+        tw.src_id,
+        tw.src_bill_no,
+        tw.f_mblno,
+        tw.f_product_name,
+        tw.f_marks,
+        tw.f_chargedate,
+        tw.f_billing_deadline,
+        tw.f_inventory_days,
+        tw.f_amt,
+        tw.f_billing_days,
+        tw.f_billing_qty,
+        tw.f_billtype,
+        tw.f_billingway,
+        tw.f_bsdate,
+        tw.f_originalbilldate,
+        tw.f_stltypeid,
+        sd.dict_label AS fBillingwayName,
+        tw.f_business_type,
+        tw.f_src_type_id,
+        tw.f_warehouseid,
+        th.f_warehouse_information AS fWarehouseName,
+        tw.f_purchase,
+        tw.t_productdate,
+        tw.f_lotno,
+        tw.f_valid,
+        tw.f_units,
+        tw.f_store_env,
+        tw.f_isfilles,
+        si.dict_label AS fUnitsName,
+        st.dict_label AS fStoreEnvName,
+        sti.dict_label AS fIsfillesName,
+        tw.f_allot_warehouseid,
+        te.f_warehouse_information AS fAllotWarehouseName,
+        IFNULL(tl.f_grossweightblc,0) AS fGrossweightblc,
+        IFNULL(tl.f_volumnblc,0) AS fVolumnblc,
+        IFNULL(tl.f_netweightblc,0) AS fNetweightblc,
+        tc.f_name  AS corpName
+        from t_warehousebillsfees tw
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
+        LEFT JOIN t_warehouse te ON tw.f_allot_warehouseid = te.f_id
+        LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid AND sc.dict_type = 'data_unitfees'
+        LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid AND sd.dict_type = 'f_paymode'
+        LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units AND si.dict_type = 'f_floatunit'
+        LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env AND st.dict_type = 'f_StorageEnvironment'
+        LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles AND sti.dict_type = 'f_evidence'
+        LEFT JOIN t_warehousebills ti ON ti.f_id = tw.f_pid
+        LEFT JOIN t_whgenleg tl ON tl.f_corpid = tw.f_corpid AND tl.f_goodsid = tw.f_feeid
+        AND tl.f_billingway = tw.f_feeUnitid AND tl.f_warehouse_locationid = tw.f_warehouseid
+        <where>
+            <if test="fPid != null ">and tw.f_pid = #{fPid}</if>
+            <if test="fLineno != null ">and tw.f_lineno = #{fLineno}</if>
+            <if test="fCorpid != null ">and tw.f_corpid = #{fCorpid}</if>
+            <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
+            <if test="fFeeunitid != null ">and tw.f_feeUnitid = #{fFeeunitid}</if>
+            <if test="fQty != null ">and tw.f_qty = #{fQty}</if>
+            <if test="fUnitprice != null ">and tw.f_unitprice = #{fUnitprice}</if>
+            <if test="fAmount != null ">and tw.f_amount = #{fAmount}</if>
+            <if test="fCurrency != null  and fCurrency != ''">and tw.f_currency = #{fCurrency}</if>
+            <if test="fExrate != null ">and tw.f_exrate = #{fExrate}</if>
+            <if test="fTaxrate != null ">and tw.f_taxrate = #{fTaxrate}</if>
+            <if test="fDc != null  and fDc != ''">and tw.f_dc = #{fDc}</if>
+            <if test="fBillstatus != null  and fBillstatus != ''">and tw.f_billstatus = #{fBillstatus}</if>
+            <if test="fReviewDate != null ">and tw.f_review_date = #{fReviewDate}</if>
+            <if test="fStatementNo != null  and fStatementNo != ''">and tw.f_statement_no = #{fStatementNo}</if>
+            <if test="fAccamount != null ">and tw.f_accamount = #{fAccamount}</if>
+            <if test="fStlamount != null ">and tw.f_stlamount = #{fStlamount}</if>
+            <if test="fAccamountDate != null ">and tw.f_accamount_date = #{fAccamountDate}</if>
+            <if test="fInvnos != null  and fInvnos != ''">and tw.f_invnos = #{fInvnos}</if>
+            <if test="fInvamount != null ">and tw.f_invamount = #{fInvamount}</if>
+            <if test="fStlamountNo != null  and fStlamountNo != ''">and tw.f_stlamount_no = #{fStlamountNo}</if>
+            <if test="fAskamount != null ">and tw.f_askamount = #{fAskamount}</if>
+            <if test="fStatus != null  and fStatus != ''">and tw.f_status = #{fStatus}</if>
+            <if test="delFlag != null">and tw.del_flag = #{delFlag}</if>
+            <if test="fStlamountDate != null ">and tw.f_stlamount_date = #{fStlamountDate}</if>
+            <if test="srcId != null ">and tw.src_id = #{srcId}</if>
+            <if test="srcBillNo != null  and srcBillNo != ''">and tw.src_bill_no = #{srcBillNo}</if>
+            <if test="fMblno != null  and fMblno != ''">and tw.f_mblno = #{fMblno}</if>
+            <if test="fProductName != null  and fProductName != ''">and tw.f_product_name like concat('%',
+                #{fProductName},
+                '%')
+            </if>
+            <if test="fMarks != null  and fMarks != ''">and tw.f_marks = #{fMarks}</if>
+            <if test="fChargedate != null ">and tw.f_chargedate = #{fChargedate}</if>
+            <if test="fBillingDeadline != null ">and tw.f_billing_deadline = #{fBillingDeadline}</if>
+            <if test="fInventoryDays != null ">and tw.f_inventory_days = #{fInventoryDays}</if>
+            <if test="fAmt != null ">and tw.f_amt = #{fAmt}</if>
+            <if test="fBillingDays != null ">and tw.f_billing_days = #{fBillingDays}</if>
+            <if test="fBillingQty != null ">and tw.f_billing_qty = #{fBillingQty}</if>
+            <if test="fBilltype != null  and fBilltype != ''">and tw.f_billtype = #{fBilltype}</if>
+            <if test="fBillingway != null ">and tw.f_billingway = #{fBillingway}</if>
+            <if test="fBsdate != null ">and tw.f_bsdate = #{fBsdate}</if>
+            <if test="fOriginalbilldate != null ">and tw.f_originalbilldate = #{fOriginalbilldate}</if>
+            <if test="fStltypeid != null">and tw.f_stltypeid = #{fStltypeid},</if>
+            <if test="fSrcTypeId != null">and tw.f_src_type_id = #{fSrcTypeId},</if>
+            <if test="fWarehouseid != null ">and tw.f_warehouseid = #{fWarehouseid}</if>
+            <if test="fPurchase != null ">and tw.f_purchase = #{fPurchase}</if>
+        </where>
+    </select>
+    <!--安品调入统计-->
+    <select id="selectTWarehouseFold" parameterType="TWarehousebillsfees"
+            resultType="com.ruoyi.anpin.WarhousrExcel">
+        SELECT ti.f_bsdate AS fBsdate,/*进货时间*/
+        tf.f_name AS feeName,/*物资名称*/
+        tf.f_currency AS fCurrencyName,/*物资规格*/
+        tw.f_qty AS fQty,/*实际数量*/
+        tw.f_amount AS fAmount,/*金额*/
+        tw.f_unitprice AS fUnitprice,/*单价*/
+        tc.f_name AS corpName,/*供货商*/
+        tc.f_manage AS fManage,/*联系人*/
+        tc.f_tel AS fTel,/*联系电话*/
+        tw.t_productdate AS tProductdate,/*生产日期*/
+        tw.f_lotno AS fLotno,/*批次号*/
+        CONCAT(tw.f_valid,si.dict_label) AS quality,/*保值期限*/
+        st.dict_label AS fStoreEnvName,/*储存环境中文名*/
+        sti.dict_label AS fIsfillesName,/*索证索票*/
+        std.dict_label AS fFeetype,/*物资类别*/
+        sr.user_name AS purchaseName,/*采购人*/
+        tp.f_name AS projectName,/*项目名称*/
+        CASE
+
+        WHEN tw.f_billtype = 'CK' THEN
+        '出库'
+        WHEN tw.f_billtype = 'DB' THEN
+        '调拨'
+        WHEN tw.f_billtype = 'RK' THEN
+        '入库'
+        END AS fBilltypeName,/*出入库类型*/
+        ti.f_sbu AS fSbu,/*开票公司ID*/
+        ts.f_name AS fSbuName,/*开票公司名称*/
+        sc.dict_label As feeUnitName/*计量单位中文名*/
+        FROM t_warehousebillsfees tw
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        LEFT JOIN t_warehouse th ON tw.f_warehouseid = th.f_id
+        LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid
+        AND sc.dict_type = 'data_unitfees'
+        LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid
+        AND sd.dict_type = 'f_paymode'
+        LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units
+        AND si.dict_type = 'f_floatunit'
+        LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env
+        AND st.dict_type = 'f_StorageEnvironment'
+        LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles
+        AND sti.dict_type = 'f_evidence'
+        LEFT JOIN t_warehousebills ti ON tw.f_pid = ti.f_id
+        LEFT JOIN t_project tp ON ti.f_goodsid = tp.f_id
+        LEFT JOIN t_corps tc ON ti.f_corpid = tc.f_id
+        LEFT JOIN t_corps ts ON ti.f_sbu = ts.f_id
+        LEFT JOIN sys_user sr ON sr.user_id = ti.f_purchase
+        LEFT JOIN sys_dict_data std ON std.dict_value = tf.f_feetype
+        AND std.dict_type = 'data_cost_attribute'
+        <where>
+            tw.del_flag = '0'
+            and ti.del_flag = '0'
+            and tw.f_billtype = 'DB'
+            <if test="fBillstatus != null  and fBillstatus == 1">and tw.f_billstatus = 6</if>
+            <if test="fBillstatus != null  and fBillstatus == 2">and tw.f_billstatus != 6</if>
+            <if test="fCorpid != null ">and ti.f_corpid = #{fCorpid}</if>
+            <if test="fGoodsid != null ">and ti.f_goodsid = #{fGoodsid}</if>
+            <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
+            <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
+            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+                and ti.f_bsdate &gt;= #{cLoadDate[0]}
+            </if>
+            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+                and ti.f_bsdate &lt;= #{cLoadDate[1]}
+            </if>
+        </where>
+        ORDER BY tw.f_id DESC
+    </select>
+    <!--安品调出统计-->
+    <select id="selectTWarehouseCallout" parameterType="TWarehousebillsfees"
+            resultType="com.ruoyi.anpin.WarhousrExcel">
+        SELECT ti.f_bsdate AS fBsdate,/*进货时间*/
+        tf.f_name AS feeName,/*物资名称*/
+        tf.f_currency AS fCurrencyName,/*物资规格*/
+        tw.f_qty AS fQty,/*实际数量*/
+        tw.f_amount AS fAmount,/*金额*/
+        tw.f_unitprice AS fUnitprice,/*单价*/
+        tc.f_name AS corpName,/*供货商*/
+        tc.f_manage AS fManage,/*联系人*/
+        tc.f_tel AS fTel,/*联系电话*/
+        tw.t_productdate AS tProductdate,/*生产日期*/
+        tw.f_lotno AS fLotno,/*批次号*/
+        CONCAT(tw.f_valid,si.dict_label) AS quality,/*保值期限*/
+        st.dict_label AS fStoreEnvName,/*储存环境中文名*/
+        sti.dict_label AS fIsfillesName,/*索证索票*/
+        std.dict_label AS fFeetype,/*物资类别*/
+        sr.user_name AS purchaseName,/*采购人*/
+        tp.f_name AS projectName,/*项目名称*/
+        CASE
+
+        WHEN tw.f_billtype = 'CK' THEN
+        '出库'
+        WHEN tw.f_billtype = 'DB' THEN
+        '调拨'
+        WHEN tw.f_billtype = 'RK' THEN
+        '入库'
+        END AS fBilltypeName,/*出入库类型*/
+        ti.f_sbu AS fSbu,/*开票公司ID*/
+        ts.f_name AS fSbuName,/*开票公司名称*/
+        sc.dict_label As feeUnitName/*计量单位中文名*/
+        FROM t_warehousebillsfees tw
+        LEFT JOIN t_fees tf ON tw.f_feeid = tf.f_id
+        LEFT JOIN t_warehouse th ON tw.f_allot_warehouseid = th.f_id
+        LEFT JOIN sys_dict_data sc ON sc.dict_value = tw.f_feeUnitid
+        AND sc.dict_type = 'data_unitfees'
+        LEFT JOIN sys_dict_data sd ON sd.dict_value = tw.f_stltypeid
+        AND sd.dict_type = 'f_paymode'
+        LEFT JOIN sys_dict_data si ON si.dict_value = tw.f_units
+        AND si.dict_type = 'f_floatunit'
+        LEFT JOIN sys_dict_data st ON st.dict_value = tw.f_store_env
+        AND st.dict_type = 'f_StorageEnvironment'
+        LEFT JOIN sys_dict_data sti ON sti.dict_value = tw.f_isfilles
+        AND sti.dict_type = 'f_evidence'
+        LEFT JOIN t_warehousebills ti ON tw.f_pid = ti.f_id
+        LEFT JOIN t_project tp ON ti.f_project = tp.f_id
+        LEFT JOIN t_corps tc ON tw.f_corpid = tc.f_id
+        LEFT JOIN t_corps ts ON ti.f_sbu = ts.f_id
+        LEFT JOIN sys_user sr ON sr.user_id = ti.f_purchase
+        LEFT JOIN sys_dict_data std ON std.dict_value = tf.f_feetype
+        AND std.dict_type = 'data_cost_attribute'
+        <where>
+            tw.del_flag = '0'
+            and ti.del_flag = '0'
+            and tw.f_billtype = 'DB'
+            <if test="fBillstatus != null  and fBillstatus == 1">and tw.f_billstatus = 6</if>
+            <if test="fBillstatus != null  and fBillstatus == 2">and tw.f_billstatus != 6</if>
+            <if test="fCorpid != null ">and ti.f_corpid = #{fCorpid}</if>
+            <if test="fGoodsid != null ">and ti.f_goodsid = #{fGoodsid}</if>
+            <if test="fFeeid != null ">and tw.f_feeid = #{fFeeid}</if>
+            <if test="fFeeType != null ">and tf.f_feetype = #{fFeeType}</if>
+            <if test='cLoadDate != null and cLoadDate[0] != null and cLoadDate[0]!= ""'>
+                and ti.f_bsdate &gt;= #{cLoadDate[0]}
+            </if>
+            <if test='cLoadDate != null and cLoadDate[1] != null and cLoadDate[1]!= ""'>
+                and ti.f_bsdate &lt;= #{cLoadDate[1]}
+            </if>
+        </where>
+        ORDER BY tw.f_id DESC
+    </select>
 
 </mapper>