Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java
shanxin 4 yıl önce
ebeveyn
işleme
c8cb8a2f0f
32 değiştirilmiş dosya ile 717 ekleme ve 171 silme
  1. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementStorageController.java
  2. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementTaskController.java
  3. 14 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TCorpsController.java
  4. 8 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TFeesController.java
  5. 10 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TGoodsController.java
  6. 1 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseAreaController.java
  7. 15 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseController.java
  8. 22 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java
  9. 15 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TFeesMapper.java
  10. 15 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TGoodsMapper.java
  11. 18 0
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseAreaMapper.java
  12. 20 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java
  13. 15 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITFeesService.java
  14. 14 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITGoodsService.java
  15. 2 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseAreaService.java
  16. 14 1
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseService.java
  17. 52 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java
  18. 45 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TFeesServiceImpl.java
  19. 45 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TGoodsServiceImpl.java
  20. 22 3
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseAreaServiceImpl.java
  21. 44 2
      ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java
  22. 15 15
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/domain/TWarehousebillsfees.java
  23. 1 0
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseAgreementService.java
  24. 80 5
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java
  25. 164 110
      ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java
  26. 14 2
      ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml
  27. 10 2
      ruoyi-warehouse/src/main/resources/mapper/basicData/TFeesMapper.xml
  28. 15 6
      ruoyi-warehouse/src/main/resources/mapper/basicData/TGoodsMapper.xml
  29. 8 0
      ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseAreaMapper.xml
  30. 3 3
      ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml
  31. 12 2
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml
  32. 2 1
      ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementStorageController.java

@@ -61,7 +61,7 @@ public class TWarehouseAgreementStorageController extends BaseController {
     @PreAuthorize("@ss.hasPermi('warehouseBusiness:agreementStorage:query')")
     @GetMapping(value = "/{fId}")
     public AjaxResult getInfo(@PathVariable("fId") Long fId) {
-        return AjaxResult.success(tWarehouseAgreementService.selectTWarehouseAgreementById(fId));
+        return AjaxResult.success(tWarehouseAgreementService.selectTWarehouseAgreementById1(fId));
     }
 
     /**

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/agreement/TWarehouseAgreementTaskController.java

@@ -38,7 +38,7 @@ public class TWarehouseAgreementTaskController extends BaseController {
     @GetMapping("/list")
     public TableDataInfo list(TWarehouseAgreement tWarehouseAgreement) {
         startPage();
-        tWarehouseAgreement.setfFeetypeid((long) 0);
+        tWarehouseAgreement.setfFeetypeid((long) 1);
         List<Map<String, Object>> list = tWarehouseAgreementService.selectTWarehouseAgreementList1(tWarehouseAgreement);
         return getDataTable(list);
     }

+ 14 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TCorpsController.java

@@ -1,8 +1,11 @@
 package com.ruoyi.web.controller.warehouse.basicData;
 
+import com.alibaba.fastjson.JSONArray;
 import com.ruoyi.basicData.domain.TCorps;
+import com.ruoyi.basicData.domain.TWarehouse;
 import com.ruoyi.basicData.service.ITCorpsService;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
@@ -69,6 +72,15 @@ public class TCorpsController extends BaseController {
     @Log(title = "客户详情", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestParam("corps") String tCorps, @RequestParam("customerContacts") String tCustomerContacts) {
+        // 检验编号、名称、简称 唯一
+        TCorps tCorps1 = JSONArray.parseObject(tCorps, TCorps.class);
+        if (UserConstants.NOT_UNIQUE.equals(tCorpsService.checkUFNoUnique(tCorps1))) {
+            return AjaxResult.error("新增客户'" + tCorps1.getfNo() + "'失败,编号已存在");
+        } else if (UserConstants.NOT_UNIQUE.equals(tCorpsService.checkUFNnameUnique(tCorps1))) {
+            return AjaxResult.error("新增客户'" + tCorps1.getfName() + "'失败,名称已存在");
+        } else if (UserConstants.NOT_UNIQUE.equals(tCorpsService.checkUFCnameUnique(tCorps1))) {
+            return AjaxResult.error("新增客户'" + tCorps1.getfCname() + "'失败,简称已存在");
+        }
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tCorpsService.insertTCorps(tCorps, tCustomerContacts, loginUser);
@@ -91,6 +103,7 @@ public class TCorpsController extends BaseController {
     @Log(title = "客户详情", businessType = BusinessType.DELETE)
     @DeleteMapping("/{fIds}")
     public AjaxResult remove(@PathVariable Long[] fIds) {
-        return toAjax(tCorpsService.deleteTCorpsByIds(fIds));
+
+        return tCorpsService.deleteTCorpsByIds(fIds);
     }
 }

+ 8 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TFeesController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.warehouse.basicData;
 import com.ruoyi.basicData.domain.TFees;
 import com.ruoyi.basicData.service.ITFeesService;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
@@ -65,6 +66,12 @@ public class TFeesController extends BaseController {
     @Log(title = "费用信息", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TFees tFees) {
+        // 检验编号、名称、 唯一
+        if (UserConstants.NOT_UNIQUE.equals(tFeesService.checkUFNoUnique(tFees))) {
+            return AjaxResult.error("新增费用'" + tFees.getfNo() + "'失败,编号已存在");
+        } else if (UserConstants.NOT_UNIQUE.equals(tFeesService.checkUFNnameUnique(tFees))) {
+            return AjaxResult.error("新增费用'" + tFees.getfName() + "'失败,名称已存在");
+        }
         return toAjax(tFeesService.insertTFees(tFees));
     }
 
@@ -85,6 +92,6 @@ public class TFeesController extends BaseController {
     @Log(title = "费用信息", businessType = BusinessType.DELETE)
     @DeleteMapping("/{fIds}")
     public AjaxResult remove(@PathVariable Long[] fIds) {
-        return toAjax(tFeesService.deleteTFeesByIds(fIds));
+        return tFeesService.deleteTFeesByIds(fIds);
     }
 }

+ 10 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TGoodsController.java

@@ -1,8 +1,11 @@
 package com.ruoyi.web.controller.warehouse.basicData;
 
+import com.alibaba.fastjson.JSONArray;
 import com.ruoyi.basicData.domain.TGoods;
+import com.ruoyi.basicData.domain.TWarehouse;
 import com.ruoyi.basicData.service.ITGoodsService;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
@@ -65,6 +68,12 @@ public class TGoodsController extends BaseController {
     @Log(title = "商品详情", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody TGoods tGoods) {
+        // 检验编号、名称、地址 唯一
+        if (UserConstants.NOT_UNIQUE.equals(tGoodsService.checkUFNoUnique(tGoods))) {
+            return AjaxResult.error("新增商品'" + tGoods.getfNo() + "'失败,编号已存在");
+        } else if (UserConstants.NOT_UNIQUE.equals(tGoodsService.checkUFNnameUnique(tGoods))) {
+            return AjaxResult.error("新增商品'" + tGoods.getfName() + "'失败,名称已存在");
+        }
         return toAjax(tGoodsService.insertTGoods(tGoods));
     }
 
@@ -85,6 +94,6 @@ public class TGoodsController extends BaseController {
     @Log(title = "商品详情", businessType = BusinessType.DELETE)
     @DeleteMapping("/{fIds}")
     public AjaxResult remove(@PathVariable Long[] fIds) {
-        return toAjax(tGoodsService.deleteTGoodsByIds(fIds));
+        return tGoodsService.deleteTGoodsByIds(fIds);
     }
 }

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseAreaController.java

@@ -85,6 +85,6 @@ public class TWarehouseAreaController extends BaseController {
     @Log(title = "库区", businessType = BusinessType.DELETE)
     @DeleteMapping("/{fIds}")
     public AjaxResult remove(@PathVariable Long[] fIds) {
-        return toAjax(tWarehouseAreaService.deleteTWarehouseAreaByIds(fIds));
+        return tWarehouseAreaService.deleteTWarehouseAreaByIds(fIds);
     }
 }

+ 15 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warehouse/basicData/TWarehouseController.java

@@ -1,7 +1,9 @@
 package com.ruoyi.web.controller.warehouse.basicData;
 
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.basicData.domain.TWarehouse;
+import com.ruoyi.basicData.domain.TWarehouseArea;
 import com.ruoyi.basicData.service.ITWarehouseService;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -78,9 +81,18 @@ public class TWarehouseController extends BaseController {
             return AjaxResult.error("新增仓库'" + tWarehouses.getfNo() + "'失败,编号已存在");
         } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFNnameUnique(tWarehouses))) {
             return AjaxResult.error("新增仓库'" + tWarehouses.getfName() + "'失败,名称已存在");
-        } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFAaddrUnique(tWarehouses))) {
-            return AjaxResult.error("新增仓库'" + tWarehouses.getfAddr() + "'失败,地址已存在");
         }
+        JSONArray jsonArray = JSONArray.parseArray(tWarehouseArea);
+        List<TWarehouseArea> tWarehouseAreaList = JSONObject.parseArray(jsonArray.toJSONString(), TWarehouseArea.class);
+        for (TWarehouseArea tWarehouseAreas : tWarehouseAreaList) {
+            tWarehouseAreas.setfWarehouseid(tWarehouses.getfId());
+            if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUFTWarehouseAreaNoUnique(tWarehouseAreas))) {
+                return AjaxResult.error("新增仓库'" + tWarehouseAreas.getfNo() + "'失败,库区编号已存在");
+            } else if (UserConstants.NOT_UNIQUE.equals(tWarehouseService.checkUTWarehouseAreaFNnameUnique(tWarehouseAreas))) {
+                return AjaxResult.error("新增仓库'" + tWarehouseAreas.getfName() + "'失败,库区名称已存在");
+            }
+        }
+
         // 获取当前的用户
         LoginUser loginUser = SpringUtils.getBean(TokenService.class).getLoginUser(ServletUtils.getRequest());
         return tWarehouseService.insertTWarehouse1(tWarehouse, tWarehouseArea, loginUser);
@@ -103,7 +115,7 @@ public class TWarehouseController extends BaseController {
     @Log(title = "仓库", businessType = BusinessType.DELETE)
     @DeleteMapping("/{fIds}")
     public AjaxResult remove(@PathVariable Long[] fIds) {
-        return toAjax(tWarehouseService.deleteTWarehouseByIds(fIds));
+        return tWarehouseService.deleteTWarehouseByIds(fIds);
     }
 
 

+ 22 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TCorpsMapper.java

@@ -3,6 +3,7 @@ package com.ruoyi.basicData.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ruoyi.basicData.domain.TCorps;
+import com.ruoyi.basicData.domain.TCorps;
 
 import java.util.List;
 
@@ -60,4 +61,25 @@ public interface TCorpsMapper extends BaseMapper<TCorps> {
      * @return 结果
      */
     public int deleteTCorpsByIds(Long[] fIds);
+
+    /**
+     *  检验编号唯一
+     * @param fNo
+     * @return
+     */
+    public TCorps checkFNoUnique(String fNo);
+
+    /**
+     *  检验名称
+     * @param fNname
+     * @return
+     */
+    public TCorps checkUFNnameUnique(String fNname);
+
+    /**
+     * 检验地址
+     * @param fCname
+     * @return
+     */
+    public TCorps checkUFCnameUnique(String fCname);
 }

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TFeesMapper.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.mapper;
 
 import com.ruoyi.basicData.domain.TFees;
+import com.ruoyi.basicData.domain.TGoods;
 
 import java.util.List;
 
@@ -58,4 +59,18 @@ public interface TFeesMapper {
      * @return 结果
      */
     public int deleteTFeesByIds(Long[] fIds);
+
+    /**
+     *  检验编号唯一
+     * @param fNo
+     * @return
+     */
+    public TFees checkFNoUnique(String fNo);
+
+    /**
+     *  检验名称
+     * @param fNname
+     * @return
+     */
+    public TFees checkUFNnameUnique(String fNname);
 }

+ 15 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TGoodsMapper.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.mapper;
 
 import com.ruoyi.basicData.domain.TGoods;
+import com.ruoyi.basicData.domain.TWarehouse;
 
 import java.util.List;
 
@@ -59,4 +60,18 @@ public interface TGoodsMapper {
      * @return 结果
      */
     public int deleteTGoodsByIds(Long[] fIds);
+
+    /**
+     *  检验编号唯一
+     * @param fNo
+     * @return
+     */
+    public TGoods checkFNoUnique(String fNo);
+
+    /**
+     *  检验名称
+     * @param fNname
+     * @return
+     */
+    public TGoods checkUFNnameUnique(String fNname);
 }

+ 18 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/mapper/TWarehouseAreaMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.basicData.mapper;
 
+import com.ruoyi.basicData.domain.TWarehouse;
 import com.ruoyi.basicData.domain.TWarehouseArea;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -60,4 +62,20 @@ public interface TWarehouseAreaMapper {
      * @return 结果
      */
     public int deleteTWarehouseAreaByIds(Long[] fIds);
+
+    /**
+     *  检验编号唯一
+     * @param fNo
+     * @return
+     */
+    public TWarehouseArea checkFNoUnique(@Param("fNo")String fNo,@Param("fWarehouseid")Long fWarehouseid);
+
+    /**
+     *  检验名称
+     * @param fNname
+     * @return
+     */
+    public TWarehouseArea checkUFNnameUnique(@Param("fNname")String fNname,@Param("fWarehouseid")Long  fWarehouseid);
+
+
 }

+ 20 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITCorpsService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.service;
 
 import com.ruoyi.basicData.domain.TCorps;
+import com.ruoyi.basicData.domain.TWarehouse;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 
@@ -54,7 +55,7 @@ public interface ITCorpsService {
      * @param fIds 需要删除的客户详情ID
      * @return 结果
      */
-    public int deleteTCorpsByIds(Long[] fIds);
+    public AjaxResult deleteTCorpsByIds(Long[] fIds);
 
     /**
      * 删除客户详情信息
@@ -63,4 +64,22 @@ public interface ITCorpsService {
      * @return 结果
      */
     public int deleteTCorpsById(Long fId);
+
+    /**
+     *  检验编号唯一
+     * @return
+     */
+    public String checkUFNoUnique(TCorps tCorps);
+
+    /**
+     *  检验编号名称
+     * @return
+     */
+    public String checkUFNnameUnique(TCorps tCorps);
+
+    /**
+     *  检验编号地址
+     * @return
+     */
+    public String checkUFCnameUnique(TCorps tCorps);
 }

+ 15 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITFeesService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.basicData.service;
 
 import com.ruoyi.basicData.domain.TFees;
+import com.ruoyi.basicData.domain.TGoods;
+import com.ruoyi.common.core.domain.AjaxResult;
 
 import java.util.List;
 
@@ -49,7 +51,7 @@ public interface ITFeesService {
      * @param fIds 需要删除的费用信息ID
      * @return 结果
      */
-    public int deleteTFeesByIds(Long[] fIds);
+    public AjaxResult deleteTFeesByIds(Long[] fIds);
 
     /**
      * 删除费用信息信息
@@ -58,4 +60,16 @@ public interface ITFeesService {
      * @return 结果
      */
     public int deleteTFeesById(Long fId);
+
+    /**
+     *  检验编号唯一
+     * @return
+     */
+    public String checkUFNoUnique(TFees tFees);
+
+    /**
+     *  检验编号名称
+     * @return
+     */
+    public String checkUFNnameUnique(TFees tFees);
 }

+ 14 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITGoodsService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.service;
 
 import com.ruoyi.basicData.domain.TGoods;
+import com.ruoyi.common.core.domain.AjaxResult;
 
 import java.util.List;
 
@@ -50,7 +51,7 @@ public interface ITGoodsService {
      * @param fIds 需要删除的商品详情ID
      * @return 结果
      */
-    public int deleteTGoodsByIds(Long[] fIds);
+    public AjaxResult deleteTGoodsByIds(Long[] fIds);
 
     /**
      * 删除商品详情信息
@@ -59,4 +60,16 @@ public interface ITGoodsService {
      * @return 结果
      */
     public int deleteTGoodsById(Long fId);
+
+    /**
+     *  检验编号唯一
+     * @return
+     */
+    public String checkUFNoUnique(TGoods tGoods);
+
+    /**
+     *  检验编号名称
+     * @return
+     */
+    public String checkUFNnameUnique(TGoods tGoods);
 }

+ 2 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseAreaService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.service;
 
 import com.ruoyi.basicData.domain.TWarehouseArea;
+import com.ruoyi.common.core.domain.AjaxResult;
 
 import java.util.List;
 
@@ -49,7 +50,7 @@ public interface ITWarehouseAreaService {
      * @param fIds 需要删除的库区ID
      * @return 结果
      */
-    public int deleteTWarehouseAreaByIds(Long[] fIds);
+    public AjaxResult deleteTWarehouseAreaByIds(Long[] fIds);
 
     /**
      * 删除库区信息

+ 14 - 1
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/ITWarehouseService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.basicData.service;
 
 import com.ruoyi.basicData.domain.TWarehouse;
+import com.ruoyi.basicData.domain.TWarehouseArea;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 
@@ -53,7 +54,7 @@ public interface ITWarehouseService {
      * @param fIds 需要删除的仓库ID
      * @return 结果
      */
-    public int deleteTWarehouseByIds(Long[] fIds);
+    public AjaxResult deleteTWarehouseByIds(Long[] fIds);
 
     /**
      * 删除仓库信息
@@ -81,4 +82,16 @@ public interface ITWarehouseService {
      */
     public String checkUFAaddrUnique(TWarehouse tWarehouse);
 
+    /**
+     *  检验编号唯一
+     * @return
+     */
+    public String checkUFTWarehouseAreaNoUnique(TWarehouseArea tWarehouseAreas);
+
+    /**
+     *  检验编号名称
+     * @return
+     */
+    public String checkUTWarehouseAreaFNnameUnique(TWarehouseArea tWarehouseAreas);
+
 }

+ 52 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TCorpsServiceImpl.java

@@ -4,16 +4,21 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.basicData.domain.TCorps;
 import com.ruoyi.basicData.domain.TCustomerContact;
+import com.ruoyi.basicData.domain.TWarehouse;
 import com.ruoyi.basicData.mapper.TCorpsMapper;
 import com.ruoyi.basicData.mapper.TCustomerContactMapper;
 import com.ruoyi.basicData.service.ITCorpsService;
+import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.*;
 
@@ -31,6 +36,9 @@ public class TCorpsServiceImpl implements ITCorpsService {
     @Autowired
     private TCustomerContactMapper tCustomerContactMapper;
 
+    @Autowired
+    private TWarehouseBillsMapper tWarehouseBillsMapper;
+
     /**
      * 查询客户详情
      *
@@ -129,8 +137,23 @@ public class TCorpsServiceImpl implements ITCorpsService {
      * @return 结果
      */
     @Override
-    public int deleteTCorpsByIds(Long[] fIds) {
-        return tCorpsMapper.deleteTCorpsByIds(fIds);
+    @Transactional
+    public AjaxResult deleteTCorpsByIds(Long[] fIds) {
+        //return tCorpsMapper.deleteTCorpsByIds(fIds);
+        // 查询仓库主表 是否有客户存在
+        int i = 1;
+        for(Long id:fIds){
+            TWarehouseBills tWarehouseBill =new TWarehouseBills();
+            tWarehouseBill.setfCorpid(id);
+            List<TWarehouseBills>   tWarehouseBillList=tWarehouseBillsMapper.selectTWarehousebillsList(tWarehouseBill);
+            if(tWarehouseBillList!=null && !tWarehouseBillList.isEmpty()){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("客户第" + i + "行仓库有货物不可删除");
+            }
+            tCorpsMapper.deleteTCorpsById(id);
+            i++;
+        }
+        return AjaxResult.success();
     }
 
     /**
@@ -143,4 +166,31 @@ public class TCorpsServiceImpl implements ITCorpsService {
     public int deleteTCorpsById(Long fId) {
         return tCorpsMapper.deleteTCorpsById(fId);
     }
+
+    @Override
+    public String checkUFNoUnique(TCorps tCorps) {
+        TCorps tCorps1 = tCorpsMapper.checkFNoUnique(tCorps.getfNo());
+        if (StringUtils.isNotNull(tCorps1) && tCorps1.getfId()!=tCorps.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkUFNnameUnique(TCorps tCorps) {
+        TCorps tCorps1 = tCorpsMapper.checkUFNnameUnique(tCorps.getfName());
+        if (StringUtils.isNotNull(tCorps1) && tCorps1.getfId()!=tCorps.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkUFCnameUnique(TCorps tCorps) {
+        TCorps tCorps1 = tCorpsMapper.checkUFCnameUnique(tCorps.getfCname());
+        if (StringUtils.isNotNull(tCorps1) && tCorps1.getfId()!=tCorps.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
 }

+ 45 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TFeesServiceImpl.java

@@ -1,11 +1,20 @@
 package com.ruoyi.basicData.service.impl;
 
 import com.ruoyi.basicData.domain.TFees;
+import com.ruoyi.basicData.domain.TGoods;
 import com.ruoyi.basicData.mapper.TFeesMapper;
 import com.ruoyi.basicData.service.ITFeesService;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsfees;
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
+import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsfeesMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.List;
 
@@ -20,6 +29,8 @@ public class TFeesServiceImpl implements ITFeesService {
     @Autowired
     private TFeesMapper tFeesMapper;
 
+    @Autowired
+    private TWarehousebillsfeesMapper tWarehousebillsfeesMapper;
     /**
      * 查询费用信息
      *
@@ -73,8 +84,22 @@ public class TFeesServiceImpl implements ITFeesService {
      * @return 结果
      */
     @Override
-    public int deleteTFeesByIds(Long[] fIds) {
-        return tFeesMapper.deleteTFeesByIds(fIds);
+    @Transactional
+    public AjaxResult deleteTFeesByIds(Long[] fIds) {
+        // return tFeesMapper.deleteTFeesByIds(fIds);
+        int i = 1;
+        for(Long id:fIds){
+            TWarehousebillsfees tWarehousebillsfees =new TWarehousebillsfees();
+            tWarehousebillsfees.setfFeeid(id);
+            List<TWarehousebillsfees> TWarehousebillsfeesList =tWarehousebillsfeesMapper.selectTWarehousebillsfeesList(tWarehousebillsfees);
+            if(TWarehousebillsfeesList!=null && !TWarehousebillsfeesList.isEmpty()){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("费用第" + i + "行不可删除");
+            }
+            tFeesMapper.deleteTFeesById(id);
+            i++;
+        }
+        return AjaxResult.success();
     }
 
     /**
@@ -87,4 +112,22 @@ public class TFeesServiceImpl implements ITFeesService {
     public int deleteTFeesById(Long fId) {
         return tFeesMapper.deleteTFeesById(fId);
     }
+
+    @Override
+    public String checkUFNoUnique(TFees tFees) {
+        TFees tFees1= tFeesMapper.checkFNoUnique(tFees.getfNo());
+        if (StringUtils.isNotNull(tFees1) && tFees1.getfId()!=tFees.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkUFNnameUnique(TFees tFees) {
+        TFees tFees1 = tFeesMapper.checkUFNnameUnique(tFees.getfName());
+        if (StringUtils.isNotNull(tFees1) && tFees1.getfId()!=tFees.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
 }

+ 45 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TGoodsServiceImpl.java

@@ -3,9 +3,17 @@ package com.ruoyi.basicData.service.impl;
 import com.ruoyi.basicData.domain.TGoods;
 import com.ruoyi.basicData.mapper.TGoodsMapper;
 import com.ruoyi.basicData.service.ITGoodsService;
+import com.ruoyi.common.constant.UserConstants;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
+import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.List;
 
@@ -20,6 +28,9 @@ public class TGoodsServiceImpl implements ITGoodsService {
     @Autowired
     private TGoodsMapper tGoodsMapper;
 
+    @Autowired
+    private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
+
     /**
      * 查询商品详情
      *
@@ -73,8 +84,22 @@ public class TGoodsServiceImpl implements ITGoodsService {
      * @return 结果
      */
     @Override
-    public int deleteTGoodsByIds(Long[] fIds) {
-        return tGoodsMapper.deleteTGoodsByIds(fIds);
+    @Transactional
+    public AjaxResult deleteTGoodsByIds(Long[] fIds) {
+        // return tGoodsMapper.deleteTGoodsByIds(fIds);
+        int i = 1;
+        for(Long id:fIds){
+            TWarehousebillsitems tWarehousebillsitems =new TWarehousebillsitems();
+            tWarehousebillsitems.setfGoodsid(id);
+            List<TWarehousebillsitems> warehousebillsitemsList1 =tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
+            if(warehousebillsitemsList1!=null && !warehousebillsitemsList1.isEmpty()){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("商品第" + i + "行 仓库有货物不可删除");
+            }
+            tGoodsMapper.deleteTGoodsById(id);
+            i++;
+        }
+        return AjaxResult.success();
     }
 
     /**
@@ -87,4 +112,22 @@ public class TGoodsServiceImpl implements ITGoodsService {
     public int deleteTGoodsById(Long fId) {
         return tGoodsMapper.deleteTGoodsById(fId);
     }
+
+    @Override
+    public String checkUFNoUnique(TGoods tGoods) {
+        TGoods tGoods1 = tGoodsMapper.checkFNoUnique(tGoods.getfNo());
+        if (StringUtils.isNotNull(tGoods1) && tGoods1.getfId()!=tGoods.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkUFNnameUnique(TGoods tGoods) {
+        TGoods tGoods1 = tGoodsMapper.checkUFNnameUnique(tGoods.getfName());
+        if (StringUtils.isNotNull(tGoods1) && tGoods1.getfId()!=tGoods.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
 }

+ 22 - 3
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseAreaServiceImpl.java

@@ -3,7 +3,12 @@ package com.ruoyi.basicData.service.impl;
 import com.ruoyi.basicData.domain.TWarehouseArea;
 import com.ruoyi.basicData.mapper.TWarehouseAreaMapper;
 import com.ruoyi.basicData.service.ITWarehouseAreaService;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.domain.TWarehousebillsitems;
+import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
+import com.ruoyi.warehouseBusiness.mapper.TWarehousebillsitemsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -20,6 +25,10 @@ public class TWarehouseAreaServiceImpl implements ITWarehouseAreaService {
     @Autowired
     private TWarehouseAreaMapper tWarehouseAreaMapper;
 
+    @Autowired
+    private TWarehousebillsitemsMapper tWarehousebillsitemsMapper;
+
+
     /**
      * 查询库区
      *
@@ -69,12 +78,22 @@ public class TWarehouseAreaServiceImpl implements ITWarehouseAreaService {
     /**
      * 批量删除库区
      *
-     * @param fIds 需要删除的库区ID
+     * @param fId 需要删除的库区ID
      * @return 结果
      */
     @Override
-    public int deleteTWarehouseAreaByIds(Long[] fIds) {
-        return tWarehouseAreaMapper.deleteTWarehouseAreaByIds(fIds);
+    public AjaxResult deleteTWarehouseAreaByIds(Long[] fId) {
+        //  tWarehouseAreaMapper.deleteTWarehouseAreaByIds(fId);
+        for(Long id:fId){
+            TWarehousebillsitems tWarehousebillsitems =new TWarehousebillsitems();
+            tWarehousebillsitems.setfWarehouselocid(id);
+            List<TWarehousebillsitems> warehousebillsitemsList1 =tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
+            if(warehousebillsitemsList1!=null && !warehousebillsitemsList1.isEmpty()){
+                return AjaxResult.error("库区有货物不可删除");
+            }
+            tWarehouseAreaMapper.deleteTWarehouseAreaById(id);
+        }
+        return AjaxResult.success();
     }
 
     /**

+ 44 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java

@@ -12,8 +12,12 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.warehouseBusiness.mapper.TWarehouseBillsMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -34,6 +38,10 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
     @Autowired
     private TWarehouseAreaMapper tWarehouseAreaMapper;
 
+    @Autowired
+    private TWarehouseBillsMapper tWarehouseBillsMapper;
+
+
     /**
      * 查询仓库
      *
@@ -138,8 +146,23 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
      * @return 结果
      */
     @Override
-    public int deleteTWarehouseByIds(Long[] fIds) {
-        return tWarehouseMapper.deleteTWarehouseByIds(fIds);
+    @Transactional
+    public AjaxResult deleteTWarehouseByIds(Long[] fIds) {
+        // 查询仓库主表 是否有仓库在使用
+        int i = 1;
+        for(Long id:fIds){
+            TWarehouseBills   tWarehouseBill =new TWarehouseBills();
+            tWarehouseBill.setfWarehouseid(id);
+            List<TWarehouseBills>   tWarehouseBillList=tWarehouseBillsMapper.selectTWarehousebillsList(tWarehouseBill);
+            if(tWarehouseBillList!=null && !tWarehouseBillList.isEmpty()){
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("仓库第" + i + "行仓库有货物不可删除");
+            }
+            tWarehouseMapper.deleteTWarehouseById(id);
+            i++;
+        }
+        // tWarehouseMapper.deleteTWarehouseByIds(fIds);
+        return AjaxResult.success();
     }
 
     /**
@@ -179,4 +202,23 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
         }
         return UserConstants.UNIQUE;
     }
+
+    @Override
+    public String checkUFTWarehouseAreaNoUnique(TWarehouseArea tWarehouseAreas) {
+        TWarehouseArea tWarehouseAreas1 = tWarehouseAreaMapper.checkFNoUnique(tWarehouseAreas.getfNo(),tWarehouseAreas.getfWarehouseid());
+        if (StringUtils.isNotNull(tWarehouseAreas1) && tWarehouseAreas1.getfId()!=tWarehouseAreas.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
+    @Override
+    public String checkUTWarehouseAreaFNnameUnique(TWarehouseArea tWarehouseAreas) {
+        TWarehouseArea tWarehouseAreas1 = tWarehouseAreaMapper.checkUFNnameUnique(tWarehouseAreas.getfName(),tWarehouseAreas.getfWarehouseid());
+        if (StringUtils.isNotNull(tWarehouseAreas1) && tWarehouseAreas1.getfId()!=tWarehouseAreas.getfId()) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
 }

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

@@ -68,7 +68,7 @@ public class TWarehousebillsfees extends BaseEntity {
      * 金额,2位小数f_qty* f_amount
      */
     @Excel(name = "金额,2位小数f_qty* f_amount")
-    private Long fAmount;
+    private BigDecimal fAmount;
 
     /**
      * 币别
@@ -104,13 +104,13 @@ public class TWarehousebillsfees extends BaseEntity {
      * 对账金额
      */
     @Excel(name = "对账金额")
-    private Long fAccamount;
+    private BigDecimal fAccamount;
 
     /**
      * 结算金额
      */
     @Excel(name = "结算金额")
-    private Long fStlamount;
+    private BigDecimal fStlamount;
 
     /**
      * 发票号
@@ -122,13 +122,13 @@ public class TWarehousebillsfees extends BaseEntity {
      * 开票金额
      */
     @Excel(name = "开票金额")
-    private Long fInvamount;
+    private BigDecimal fInvamount;
 
     /**
      * 申请金额
      */
     @Excel(name = "申请金额")
-    private Long fAskamount;
+    private BigDecimal fAskamount;
 
     /**
      * 状态
@@ -206,11 +206,11 @@ public class TWarehousebillsfees extends BaseEntity {
         return fUnitprice;
     }
 
-    public void setfAmount(Long fAmount) {
+    public void setfAmount(BigDecimal fAmount) {
         this.fAmount = fAmount;
     }
 
-    public Long getfAmount() {
+    public BigDecimal getfAmount() {
         return fAmount;
     }
 
@@ -254,19 +254,19 @@ public class TWarehousebillsfees extends BaseEntity {
         return fBillstatus;
     }
 
-    public void setfAccamount(Long fAccamount) {
+    public void setfAccamount(BigDecimal fAccamount) {
         this.fAccamount = fAccamount;
     }
 
-    public Long getfAccamount() {
+    public BigDecimal getfAccamount() {
         return fAccamount;
     }
 
-    public void setfStlamount(Long fStlamount) {
+    public void setfStlamount(BigDecimal fStlamount) {
         this.fStlamount = fStlamount;
     }
 
-    public Long getfStlamount() {
+    public BigDecimal getfStlamount() {
         return fStlamount;
     }
 
@@ -278,19 +278,19 @@ public class TWarehousebillsfees extends BaseEntity {
         return fInvnos;
     }
 
-    public void setfInvamount(Long fInvamount) {
+    public void setfInvamount(BigDecimal fInvamount) {
         this.fInvamount = fInvamount;
     }
 
-    public Long getfInvamount() {
+    public BigDecimal getfInvamount() {
         return fInvamount;
     }
 
-    public void setfAskamount(Long fAskamount) {
+    public void setfAskamount(BigDecimal fAskamount) {
         this.fAskamount = fAskamount;
     }
 
-    public Long getfAskamount() {
+    public BigDecimal getfAskamount() {
         return fAskamount;
     }
 

+ 1 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/ITWarehouseAgreementService.java

@@ -23,6 +23,7 @@ public interface ITWarehouseAgreementService {
      */
     public TWarehouseAgreement selectTWarehouseAgreementById(Long fId);
 
+    public Map<String, Object> selectTWarehouseAgreementById1(Long fId);
     /**
      * 查询仓储费列表
      *

+ 80 - 5
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -1,17 +1,16 @@
 package com.ruoyi.warehouseBusiness.service.impl;
 
 
-import cn.hutool.core.collection.CollUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.core.domain.model.LoginUser;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.warehouseBusiness.domain.BillnoDel;
-import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreement;
-import com.ruoyi.warehouseBusiness.domain.TWarehouseAgreementitems;
-import com.ruoyi.warehouseBusiness.domain.TWarehouseBills;
+import com.ruoyi.reportManagement.domain.TWhgenleg;
+import com.ruoyi.system.mapper.SysDeptMapper;
+import com.ruoyi.warehouseBusiness.domain.*;
 import com.ruoyi.warehouseBusiness.mapper.BillnoDelMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseAgreementMapper;
 import com.ruoyi.warehouseBusiness.mapper.TWarehouseAgreementitemsMapper;
@@ -23,6 +22,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.*;
 
 /**
  * 仓储费Service业务层处理
@@ -44,6 +44,19 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
     @Autowired
     private BillnoDelMapper billnoDelMapper;
 
+    @Autowired
+    private TCorpsMapper tCorpsMapper;
+
+    @Autowired
+    private TGoodsMapper tGoodsMapper;
+
+    @Autowired
+    private TFeesMapper tFeesMapper;
+
+    @Autowired
+    private SysDeptMapper sysDeptMapper;
+
+
     /**
      * 查询仓储费
      *
@@ -55,6 +68,66 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
         return tWarehouseAgreementMapper.selectTWarehouseAgreementById(fId);
     }
 
+    @Override
+    public Map<String, Object> selectTWarehouseAgreementById1(Long fId) {
+        Map<String, Object> map = new HashMap<>();
+        // 查询协议主表数据
+        TWarehouseAgreement tWarehouseAgreement = tWarehouseAgreementMapper.selectTWarehouseAgreementById(fId);
+        // 客户表
+        List<Long> corpsId = new ArrayList<>();
+        // 用户表
+        List<SysUser> sysUserList = new ArrayList<>();
+        // 商品
+        List<Long> goodsId = new ArrayList<>();
+        // 费用
+        List<Long> feesId = new ArrayList<>();
+        if (!StringUtils.isNull(tWarehouseAgreement)) {
+            corpsId.add(tWarehouseAgreement.getfCorpid());
+            goodsId.add(tWarehouseAgreement.getfGoodsid());
+            map.put("tWarehouseAgreement", tWarehouseAgreement);
+        }
+        // 协议从表
+        TWarehouseAgreementitems tWarehouseAgreementitems = new TWarehouseAgreementitems();
+        tWarehouseAgreementitems.setfPid(fId);
+        List<TWarehouseAgreementitems> tWarehouseAgreementitemss = tWarehouseAgreementitemsMapper.selectTWarehouseAgreementitemsList(tWarehouseAgreementitems);
+        if (StringUtils.isNotEmpty(tWarehouseAgreementitemss)) {
+            for (TWarehouseAgreementitems  fees : tWarehouseAgreementitemss) {
+                feesId.add(fees.getfFeeid());
+            }
+        }
+        List<TCorps> corpsList = new ArrayList<>();
+        List<Long> corpsIdList = StringUtils.integerDeduplication(corpsId);
+        for (Long corpId : corpsIdList) {
+            TCorps corps = tCorpsMapper.selectTCorpsById(corpId);
+            if (StringUtils.isNotNull(corps)) {
+                corpsList.add(corps);
+            }
+        }
+        List<TGoods> goodsList = new ArrayList<>();
+        List<Long> goodsIdList = StringUtils.integerDeduplication(goodsId);
+        for (Long goods : goodsIdList) {
+            TGoods tGoods = tGoodsMapper.selectTGoodsById(goods);
+            if (StringUtils.isNotNull(tGoods)) {
+                goodsList.add(tGoods);
+            }
+        }
+        List<TFees> feesList = new ArrayList<>();
+        List<Long> longList = StringUtils.integerDeduplication(feesId);
+        for (Long fees : longList) {
+            TFees tFees = tFeesMapper.selectTFeesById(fees);
+            if (StringUtils.isNotNull(tFees)) {
+                feesList.add(tFees);
+            }
+        }
+        map.put("corps", corpsList);
+        map.put("goodsList", goodsList);
+        map.put("feesList", feesList);
+        map.put("tWarehouseAgreementitems", tWarehouseAgreementitemss);
+        map.put("dept", sysDeptMapper.selectDeptById(tWarehouseAgreement.getfDeptid()));
+        return map;
+    }
+
+
     /**
      * 查询仓储费列表
      *
@@ -96,6 +169,8 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
             // 业务编码
             String billNo = billnoSerialServiceImpl.getBillNo("WA", new Date());
             tWarehouseAgreement.setfBillno(billNo);
+            tWarehouseAgreement.setCreateBy(loginUser.getUser().getUserName());
+            tWarehouseAgreement.setfDeptid(loginUser.getUser().getDeptId());
             tWarehouseAgreementMapper.insertTWarehouseAgreement(tWarehouseAgreement);
             fPid = tWarehouseAgreement.getfId();
         }else{

+ 164 - 110
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -126,7 +126,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         List<Map<String, Object>> mapList = tWarehousebillsitemsMapper.selectGoodsTransferitemsList(tWarehousebillsitems);
         if (StringUtils.isNotEmpty(mapList)) {
             for (Map<String, Object> wb : mapList) {
-                TWhgenleg tWhgenleg = new TWhgenleg();
+                /*TWhgenleg tWhgenleg = new TWhgenleg();
                 tWhgenleg.setfCorpid(tWarehousebills.getfCorpid());
                 if (StringUtils.isNotNull(wb.get("fGoodsid"))) {
                     tWhgenleg.setfGoodsid(((Integer) wb.get("fGoodsid")).longValue());
@@ -139,7 +139,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 TWhgenleg whgenleg = tWhgenlegMapper.selectTWhgenleg(tWhgenleg);
                 if (StringUtils.isNotNull(whgenleg)) {
                     wb.put("fQtyblc", whgenleg.getfQtyblc());
-                }
+                }*/
                 if (StringUtils.isNotNull(wb.get("fGoodsid"))) {
                     Integer fGoodsid = (Integer) wb.get("fGoodsid");
                     goodsId.add(fGoodsid.longValue());
@@ -372,16 +372,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             tWarehouseBillsMapper.insertTWarehousebills(warehouseBills);
             fPid = warehouseBills.getfId();
         } else {
-            /*// 提交时:  生流水号
-            if ("6".equals(warehouseBills.getfBillstatus())) {
-                // 业务编码
-                String billNo = billnoSerialServiceImpl.getBillNo(billsType, warehouseBills.getfBsdate());
-                warehouseBills.setfBillno(billNo);
-                // 存货编码
-                Date time = new Date();
-                String bscorpno = billnoSerialServiceImpl.getCorpNo(warehouseBills.getfCorpid(), time);
-                warehouseBills.setfBscorpno(bscorpno);
-            }*/
             fPid = warehouseBills.getfId();
             warehouseBills.setUpdateBy(loginUser.getUser().getUserName());
             warehouseBills.setUpdateTime(new Date());
@@ -467,15 +457,18 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         if (tWarehousebillsitems != null) {
             JSONArray warehouseJSON = JSONArray.parseArray(tWarehousebillsitems);
             List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
-            int  notInStorage=0;
-            int  Stored=0;
+            int notInStorage = 0;
+            int Stored = 0;
             for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
-                if(wbItem.getfBillstatus()==null){
+                if (wbItem.getfBillstatus() == null) {
                     wbItem.setfBillstatus("1");
                     notInStorage++;
-                }else {
+                } else if (wbItem.getfBillstatus().equals("6")) {
                     wbItem.setfBillstatus("6");
                     Stored++;
+                } else if (wbItem.getfBillstatus().equals("1")) {
+                    wbItem.setfBillstatus("1");
+                    notInStorage++;
                 }
                 wbItem.setfPid(fPid);
                 wbItem.setfMarks(warehouseBills.getfMarks());
@@ -485,11 +478,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
                 tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem);
             }
             // 录入库存明细整体状态
-            TWarehouseBills warehouseBill=new TWarehouseBills();
+            TWarehouseBills warehouseBill = new TWarehouseBills();
             warehouseBill.setfId(fPid);
-            if(Stored==0){ // 未入库
+            if (Objects.equals(Stored, 0)) { // 未入库
                 warehouseBill.setfItemsStatus("1");
-            } else if(notInStorage==0){ // 已入库
+            } else if (Objects.equals(notInStorage, 0)) { // 已入库
                 warehouseBill.setfItemsStatus("6");
             } else { // 有已入库、有未入库
                 warehouseBill.setfItemsStatus("2");
@@ -537,12 +530,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
 
     /**
      * 入库详情入账
-     * @param warehouseBills        主表
-     * @param warehousebillsitems   明细
-     * @param whgenleg              附件
-     * @param loginUser             当前登录人
-     * @param billsType             状态
-     * @return  结果
+     *
+     * @param warehouseBills      主表
+     * @param warehousebillsitems 明细
+     * @param whgenleg            附件
+     * @param loginUser           当前登录人
+     * @param billsType           状态
+     * @return 结果
      */
     @Override
     @Transactional
@@ -560,7 +554,6 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             tWarehouseBills.setUpdateTime(new Date());
             tWarehouseBillsMapper.updateTWarehousebills(tWarehouseBills);
             fPid = tWarehouseBills.getfId();
-            tWarehousebillsitemsMapper.deleteByFPid(fPid);
             tEnclosureMapper.deleteByFPid(fPid);
         } else {
             // 业务编码
@@ -574,34 +567,66 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             tWarehouseBills.setCreateTime(new Date());
             tWarehouseBills.setfBsdeptid(loginUser.getUser().getDeptId());
             // 已入账
-            tWarehouseBills.setfBillstatus("7");
+            tWarehouseBills.setfBillstatus("2");
             tWarehouseBillsMapper.insertTWarehousebills(tWarehouseBills);
             fPid = tWarehouseBills.getfId();
         }
         JSONArray warehouseJSON = JSONArray.parseArray(warehousebillsitems);
         List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
         for (TWarehousebillsitems item : warehousebillsitemsList) {
-            if (!"6".equals(item.getfBillstatus())) {
-                TWhgenleg tWhgenle = queryTWhgenleg(tWarehouseBills, item);
-                if (StringUtils.isNotNull(tWhgenle)) {
-                    updateTWhgenlegData(item, tWhgenle.getfId(), billsType);
+            TWhgenleg tWhgenle = queryTWhgenleg(tWarehouseBills, item);
+            if (StringUtils.isNotNull(tWhgenle)) {
+                int i = updateTWhgenlegData(item, tWhgenle.getfId(), billsType);
+                if (i <= 0) {
                     return AjaxResult.error("更新库存总账失败");
-                } else {
-                    if (instalTWhgenleg(tWarehouseBills, item, loginUser.getUser()) <= 0) {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("新增库存总账失败");
-                    }
                 }
-                item.setfPid(fPid);
-                item.setfBillstatus("6");
-                item.setCreateBy(loginUser.getUser().getUserName());
-                item.setCreateTime(new Date());
-                if (tWarehousebillsitemsMapper.insertTWarehousebillsitems(item) <= 0) {
+            } else {
+                if (instalTWhgenleg(tWarehouseBills, item, loginUser.getUser()) <= 0) {
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    return AjaxResult.error("新增库存明细失败");
+                    return AjaxResult.error("新增库存总账失败");
                 }
             }
+            item.setfPid(fPid);
+            item.setfBillstatus("6");
+            item.setCreateBy(loginUser.getUser().getUserName());
+            item.setCreateTime(new Date());
+            int num = 0;
+            if (StringUtils.isNotNull(item.getfId())) {
+                num = tWarehousebillsitemsMapper.updateTWarehousebillsitems(item);
+            } else {
+                num = tWarehousebillsitemsMapper.insertTWarehousebillsitems(item);
+            }
+            if (num <= 0) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("新增库存明细失败");
+            }
         }
+        // 查询所有库存明细 修改仓库主表状态
+        int notInStorage = 0;
+        int Stored = 0;
+        TWarehousebillsitems tWarehousebillsitems = new TWarehousebillsitems();
+        tWarehousebillsitems.setfPid(fPid);
+        List<TWarehousebillsitems> warehousebillsitemsList1 = tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
+        for (TWarehousebillsitems item : warehousebillsitemsList1) {
+            if (item.getfBillstatus() == null) {
+                notInStorage++;
+            } else if (item.getfBillstatus().equals("6")) {
+                Stored++;
+            } else if (item.getfBillstatus().equals("1")) {
+                notInStorage++;
+            }
+        }
+        // 录入库存明细整体状态
+        TWarehouseBills warehouseBill = new TWarehouseBills();
+        warehouseBill.setfId(fPid);
+        if (Objects.equals(Stored, 0)) { // 未入库
+            warehouseBill.setfItemsStatus("1");
+        } else if (Objects.equals(notInStorage, 0)) { // 已入库
+            warehouseBill.setfItemsStatus("6");
+        } else { // 有已入库、有未入库
+            warehouseBill.setfItemsStatus("2");
+        }
+        tWarehouseBillsMapper.updateTWarehousebills(warehouseBill);
         if (StringUtils.isNotNull(whgenleg) && !"[]".equals(whgenleg)) {
             JSONArray jsonDrArray = JSONArray.parseArray(whgenleg);
             List<TEnclosure> tEnclosureList = JSONObject.parseArray(jsonDrArray.toJSONString(), TEnclosure.class);
@@ -613,11 +638,12 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             }
         }
         // 添加成功 主键返回 前台
-        return AjaxResult.success("成功",fPid);
+        return AjaxResult.success("成功", fPid);
     }
 
     /**
-     *    出库、调拨、货转 确认
+     * 出库、调拨、货转 确认
+     *
      * @param warehouseBills
      * @param warehousebillsitems
      * @param loginUser
@@ -625,6 +651,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
      * @return
      */
     @Override
+    @Transactional
     public AjaxResult updateCredit(String warehouseBills, String warehousebillsitems, LoginUser loginUser, String billsType) {
         Long fPid = null;
         if (StringUtils.isNull(warehouseBills) || "[]".equals(warehouseBills)) {
@@ -652,7 +679,7 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             tWarehouseBills.setCreateTime(new Date());
             tWarehouseBills.setfBsdeptid(loginUser.getUser().getDeptId());
             // 已入账
-            tWarehouseBills.setfBillstatus("7");
+            tWarehouseBills.setfBillstatus("2");
             tWarehouseBills.setfBilltype(billsType);
             tWarehouseBillsMapper.insertTWarehousebills(tWarehouseBills);
             fPid = tWarehouseBills.getfId();
@@ -661,79 +688,107 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         List<TWarehousebillsitems> warehousebillsitemsList = JSONObject.parseArray(warehouseJSON.toJSONString(), TWarehousebillsitems.class);
         int i = 1;
         for (TWarehousebillsitems wbItem : warehousebillsitemsList) {
-            if (!"6".equals(wbItem.getfBillstatus())) {
-                // 查询总账是否存在
-                TWhgenleg tWhgenle = queryTWhgenleg(tWarehouseBills, wbItem);
-                //  入库数特殊不判断入账
-                if ("SJCK".equals(billsType)) { // 出库 查询
-                    if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
+            // 查询总账是否存在
+            TWhgenleg tWhgenle = queryTWhgenleg(tWarehouseBills, wbItem);
+            //  入库数特殊不判断入账
+            if ("SJCK".equals(billsType)) { // 出库 查询
+                if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存明细第" + i + "行库存为空");
+                } else { // 非空修改库存总账
+                    //  库存 <  出库件数  、
+                    if (tWhgenle.getfQtyblc() < wbItem.getfQty()) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + i + "行库存为空");
-                    } else { // 非空修改库存总账
-                            //  库存 <  出库件数  、
-                            if (tWhgenle.getfQtyblc() < wbItem.getfQty()
-
-                               ) {
-                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                                return AjaxResult.error("库存明细第" + i + "行库存不足");
-                            }
-                            updateTWhgenlegData(wbItem, tWhgenle.getfId(), billsType);
+                        return AjaxResult.error("库存明细第" + i + "行库存不足");
                     }
-                } else if ("CKDB".equals(billsType)) { // 调拨查询
-                    if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
+                    updateTWhgenlegData(wbItem, tWhgenle.getfId(), billsType);
+                }
+            } else if ("CKDB".equals(billsType)) { // 调拨查询
+                if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return AjaxResult.error("库存明细第" + i + "行库存为空");
+                } else { // 非空修改库存总账
+                    if (tWhgenle.getfQtyblc() < wbItem.getfQty()) {  //  1、  库存 <  调拨件数  提示库存不足
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + i + "行库存为空");
-                    } else { // 非空修改库存总账
-                            if (tWhgenle.getfQtyblc() < wbItem.getfQty()) {  //  1、  库存 <  调拨件数  提示库存不足
-                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                                return AjaxResult.error("库存明细第" + i + "行库存不足");
-                            } else {  // 2、 库存足够 先 进行出库操作
-                                updateTWhgenlegData(wbItem, tWhgenle.getfId(), "SJCK");
-                            }
-                            // 3、 进行入库操作 查询是否存在库存
-                            tWarehouseBills.setfCorpid(tWarehouseBills.getfTocorpid()); // 新货权方
-                            TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehouseBills, wbItem);
-                            if (StringUtils.isNull(tWhgenle1)) {   // 5、 不存在 进行新增库存
-                                instalTWhgenleg(tWarehouseBills, wbItem, loginUser.getUser());
-                            } else { // 4、 存在 进行跟新库存
-                                    updateTWhgenlegData(wbItem, tWhgenle1.getfId(), "SJRK");
-                            }
+                        return AjaxResult.error("库存明细第" + i + "行库存不足");
+                    } else {  // 2、 库存足够 先 进行出库操作
+                        updateTWhgenlegData(wbItem, tWhgenle.getfId(), "SJCK");
                     }
-                } else if ("HQZY".equals(billsType)) { // 货转
-                    if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("库存明细第" + i + "行库存为空");
-                    } else { // 非空修改库存总账
-                            if (tWhgenle.getfQtyblc() < wbItem.getfQty()) {  //  1、  库存 <  调拨件数  提示库存不足
-                                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                                return AjaxResult.error("库存明细第" + i + "行库存不足");
-                            } else {  // 2、 库存足够 先 进行出库操作
-                                updateTWhgenlegData(wbItem, tWhgenle.getfId(), "SJCK");
-                            }
-                            // 3、 进行入库操作 查询是否存在库存
-                            tWarehouseBills.setfCorpid(tWarehouseBills.getfTocorpid()); // 新货权方
-                            TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehouseBills, wbItem);
-                            if (StringUtils.isNull(tWhgenle1)) {   // 5、 不存在 进行新增库存
-                                instalTWhgenleg(tWarehouseBills, wbItem, loginUser.getUser());
-                            } else { // 4、 存在 进行跟新库存
-                                updateTWhgenlegData(wbItem, tWhgenle1.getfId(), "SJRK");
-                            }
+                    // 3、 进行入库操作 查询是否存在库存
+                    tWarehouseBills.setfCorpid(tWarehouseBills.getfTocorpid()); // 新货权方
+                    TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehouseBills, wbItem);
+                    if (StringUtils.isNull(tWhgenle1)) {   // 5、 不存在 进行新增库存
+                        instalTWhgenleg(tWarehouseBills, wbItem, loginUser.getUser());
+                    } else { // 4、 存在 进行跟新库存
+                        updateTWhgenlegData(wbItem, tWhgenle1.getfId(), "SJRK");
                     }
                 }
-                i++;
-                wbItem.setfPid(fPid);
-                wbItem.setfBillstatus("6");
-                wbItem.setCreateBy(loginUser.getUser().getUserName());
-                wbItem.setCreateTime(new Date());
-                if (tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem) <= 0) {
+            } else if ("HQZY".equals(billsType)) { // 货转
+                if (StringUtils.isNull(tWhgenle)) { // 为空 提示没有库存
                     TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    return AjaxResult.error("库存明细更新失败");
+                    return AjaxResult.error("库存明细第" + i + "行库存为空");
+                } else { // 非空修改库存总账
+                    if (tWhgenle.getfQtyblc() < wbItem.getfQty()) {  //  1、  库存 <  调拨件数  提示库存不足
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                        return AjaxResult.error("库存明细第" + i + "行库存不足");
+                    } else {  // 2、 库存足够 先 进行出库操作
+                        updateTWhgenlegData(wbItem, tWhgenle.getfId(), "SJCK");
+                    }
+                    // 3、 进行入库操作 查询是否存在库存
+                    tWarehouseBills.setfCorpid(tWarehouseBills.getfTocorpid()); // 新货权方
+                    TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehouseBills, wbItem);
+                    if (StringUtils.isNull(tWhgenle1)) {   // 5、 不存在 进行新增库存
+                        instalTWhgenleg(tWarehouseBills, wbItem, loginUser.getUser());
+                    } else { // 4、 存在 进行跟新库存
+                        updateTWhgenlegData(wbItem, tWhgenle1.getfId(), "SJRK");
+                    }
                 }
             }
-
+            i++;
+            wbItem.setfPid(fPid);
+            wbItem.setfBillstatus("6");
+            wbItem.setfBsdate(tWarehouseBills.getfBsdate());
+            wbItem.setCreateBy(loginUser.getUser().getUserName());
+            wbItem.setCreateTime(new Date());
+            int num = 0;
+            if (StringUtils.isNotNull(wbItem.getfId())) {
+                num = tWarehousebillsitemsMapper.updateTWarehousebillsitems(wbItem);
+            } else {
+                num = tWarehousebillsitemsMapper.insertTWarehousebillsitems(wbItem);
+            }
+            if (num <= 0) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                return AjaxResult.error("库存明细更新失败");
+            }
         }
+        // 查询所有库存明细 修改仓库主表状态
+        int notInStorage = 0;
+        int Stored = 0;
+        TWarehousebillsitems tWarehousebillsitems = new TWarehousebillsitems();
+        tWarehousebillsitems.setfPid(fPid);
+        List<TWarehousebillsitems> warehousebillsitemsList1 = tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
+        for (TWarehousebillsitems item : warehousebillsitemsList1) {
+            if (item.getfBillstatus() == null) {
+                notInStorage++;
+            } else if (item.getfBillstatus().equals("6")) {
+                Stored++;
+            } else if (item.getfBillstatus().equals("1")) {
+                notInStorage++;
+            }
+        }
+        // 录入库存明细整体状态
+        TWarehouseBills warehouseBill = new TWarehouseBills();
+        warehouseBill.setfId(fPid);
+        if (Objects.equals(Stored, 0)) { // 未入库
+            warehouseBill.setfItemsStatus("1");
+        } else if (Objects.equals(notInStorage, 0)) { // 已入库
+            warehouseBill.setfItemsStatus("6");
+        } else { // 有已入库、有未入库
+            warehouseBill.setfItemsStatus("2");
+        }
+        tWarehouseBillsMapper.updateTWarehousebills(warehouseBill);
         // 添加成功 主键返回 前台
-        return AjaxResult.success("成功",fPid);
+        return AjaxResult.success("成功", fPid);
     }
 
     // 入库 收费明细 校验
@@ -767,11 +822,11 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     @Override
     public int deleteTWarehousebillsByIds(Long[] fIds) {
         // 取出业务编号、 放入 billno_del
-        for(Long id:fIds){
+        for (Long id : fIds) {
             // 1、查询主表信息
             TWarehouseBills tWarehousebills = tWarehouseBillsMapper.selectTWarehousebillsById(id);
             // 2、业务编号、客存编号 放入 billno_del
-            BillnoDel  billnoDel =new BillnoDel();
+            BillnoDel billnoDel = new BillnoDel();
             billnoDel.setBillType(tWarehousebills.getfBilltype());
             billnoDel.setBillNo(tWarehousebills.getfBillno());
             billnoDelMapper.insertBillnoDel(billnoDel);
@@ -880,5 +935,4 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
     }
 
 
-
 }

+ 14 - 2
ruoyi-warehouse/src/main/resources/mapper/basicData/TCorpsMapper.xml

@@ -49,11 +49,11 @@
         <include refid="selectTCorpsVo"/>
         <where>
             <if test="fTypeid != null  and fTypeid != ''">and f_typeid = #{fTypeid}</if>
-            <if test="fNo != null  and fNo != ''">and f_no = #{fNo}</if>
+            <if test="fNo != null  and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
             <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
             <if test="fCname != null  and fCname != ''">and f_cname like concat('%', #{fCname}, '%')</if>
             <if test="fEname != null  and fEname != ''">and f_ename like concat('%', #{fEname}, '%')</if>
-            <if test="fTel != null  and fTel != ''">and f_tel = #{fTel}</if>
+            <if test="fTel != null  and fTel != ''">and f_tel like concat('%', #{fTel}, '%')</if>
             <if test="fFax != null  and fFax != ''">and f_fax = #{fFax}</if>
             <if test="fEmail != null  and fEmail != ''">and f_email = #{fEmail}</if>
             <if test="fManage != null  and fManage != ''">and f_manage = #{fManage}</if>
@@ -209,4 +209,16 @@
         </foreach>
     </delete>
 
+    <select id="checkFNoUnique" parameterType="String" resultMap="TCorpsResult">
+	    select f_id,f_no from t_corps where f_no = #{fNo} limit 1
+    </select>
+
+    <select id="checkUFNnameUnique" parameterType="String" resultMap="TCorpsResult">
+        select f_id,f_name from t_corps where f_name = #{fAame} limit 1
+    </select>
+
+    <select id="checkUFCnameUnique" parameterType="String" resultMap="TCorpsResult">
+        select f_id,f_addr from t_corps where f_cname = #{fCname} limit 1
+    </select>
+
 </mapper>

+ 10 - 2
ruoyi-warehouse/src/main/resources/mapper/basicData/TFeesMapper.xml

@@ -27,11 +27,11 @@
     <select id="selectTFeesList" parameterType="TFees" resultMap="TFeesResult">
         <include refid="selectTFeesVo"/>
         <where>
-            <if test="fNo != null  and fNo != ''">and f_no = #{fNo}</if>
+            <if test="fNo != null  and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
             <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
             <if test="fFeetype != null  and fFeetype != ''">and f_feetype = #{fFeetype}</if>
             <if test="fFeeunitid != null ">and f_feeunitid = #{fFeeunitid}</if>
-            <if test="fCurrency != null  and fCurrency != ''">and f_currency = #{fCurrency}</if>
+            <if test="fCurrency != null  and fCurrency != ''">and f_currency like concat('%', #{fCurrency}, '%')</if>
             <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
         </where>
     </select>
@@ -103,4 +103,12 @@
         </foreach>
     </delete>
 
+    <select id="checkFNoUnique" parameterType="String" resultMap="TFeesResult">
+	    select f_id,f_no from t_fees where f_no = #{fNo} limit 1
+    </select>
+
+    <select id="checkUFNnameUnique" parameterType="String" resultMap="TFeesResult">
+        select f_id,f_name from t_fees where f_name = #{fAame} limit 1
+    </select>
+
 </mapper>

+ 15 - 6
ruoyi-warehouse/src/main/resources/mapper/basicData/TGoodsMapper.xml

@@ -32,13 +32,13 @@
         <include refid="selectTGoodsVo"/>
         <where>
             <if test="fTypeid != null  and fTypeid != ''">and f_typeid = #{fTypeid}</if>
-            <if test="fNo != null  and fNo != ''">and f_no = #{fNo}</if>
+            <if test="fNo != null  and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
             <if test="fName != null  and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
-            <if test="fEnam != null  and fEnam != ''">and f_enam = #{fEnam}</if>
-            <if test="fSpecs != null  and fSpecs != ''">and f_specs = #{fSpecs}</if>
-            <if test="fPackagespecs != null ">and f_packagespecs = #{fPackagespecs}</if>
-            <if test="fColor != null  and fColor != ''">and f_color = #{fColor}</if>
-            <if test="fHscode != null  and fHscode != ''">and f_hscode = #{fHscode}</if>
+            <if test="fEnam != null  and fEnam != ''">and f_enam like concat('%', #{fEnam}, '%')</if>
+            <if test="fSpecs != null  and fSpecs != ''">and f_specs like concat('%', #{fSpecs}, '%')</if>
+            <if test="fPackagespecs != null ">and f_packagespecs like concat('%', #{fPackagespecs}, '%')</if>
+            <if test="fColor != null  and fColor != ''">and f_color like concat('%', #{fColor}, '%')</if>
+            <if test="fHscode != null  and fHscode != ''">and f_hscode like concat('%', #{fHscode}, '%')</if>
             <if test="fPackageid != null ">and f_packageid = #{fPackageid}</if>
             <if test="fStatus != null  and fStatus != ''">and f_status = #{fStatus}</if>
         </where>
@@ -123,4 +123,13 @@
         </foreach>
     </delete>
 
+    <select id="checkFNoUnique" parameterType="String" resultMap="TGoodsResult">
+	    select f_id,f_no from t_goods where f_no = #{fNo} limit 1
+    </select>
+
+    <select id="checkUFNnameUnique" parameterType="String" resultMap="TGoodsResult">
+        select f_id,f_name from t_goods where f_name = #{fAame} limit 1
+    </select>
+
+
 </mapper>

+ 8 - 0
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseAreaMapper.xml

@@ -102,4 +102,12 @@
         </foreach>
     </delete>
 
+    <select id="checkFNoUnique"  resultMap="TWarehouseAreaResult">
+	    select f_id,f_no from t_warehouse_area where f_no = #{fNo}  and f_warehouseid = #{fWarehouseid} limit 1
+    </select>
+
+    <select id="checkUFNnameUnique"  resultMap="TWarehouseAreaResult">
+        select f_id,f_name from t_warehouse_area where f_name = #{fNname}  and f_warehouseid = #{fWarehouseid} limit 1
+    </select>
+
 </mapper>

+ 3 - 3
ruoyi-warehouse/src/main/resources/mapper/basicData/TWarehouseMapper.xml

@@ -26,10 +26,10 @@
     <select id="selectTWarehouseList" parameterType="TWarehouse" resultMap="TWarehouseResult">
         <include refid="selectTWarehouseVo"/>
         <where>
-            <if test="fNo != null  and fNo != ''"> and f_no = #{fNo}</if>
+            <if test="fNo != null  and fNo != ''"> and f_no like concat('%', #{fNo}, '%')</if>
             <if test="fName != null  and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
-            <if test="fAddr != null  and fAddr != ''"> and f_addr = #{fAddr}</if>
-            <if test="fTotalgross != null "> and f_totalgross = #{fTotalgross}</if>
+            <if test="fAddr != null  and fAddr != ''"> and f_addr like concat('%', #{fAddr}, '%')</if>
+            <if test="fTotalgross != null "> and f_totalgross like concat('%', #{fTotalgross}, '%')</if>
             <if test="fStatus != null  and fStatus != ''"> and f_status = #{fStatus}</if>
         </where>
     </select>

+ 12 - 2
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementMapper.xml

@@ -7,8 +7,10 @@
     <resultMap type="TWarehouseAgreement" id="TWarehouseAgreementResult">
         <result property="fId" column="f_id"/>
         <result property="fBillno" column="f_billno"/>
+        <result property="fContractno" column="f_contractno"/>
         <result property="fDeptid" column="f_deptid"/>
         <result property="fCorpid" column="f_corpid"/>
+        <result property="fGoodsid" column="f_goodsid"/>
         <result property="fStltypeid" column="f_stltypeid"/>
         <result property="fFeetypeid" column="f_feetypeid"/>
         <result property="tPackages" column="t_packages"/>
@@ -26,7 +28,7 @@
     </resultMap>
 
     <sql id="selectTWarehouseAgreementVo">
-        select f_id, f_billno, f_deptid, f_corpid, f_stltypeid, f_feetypeid, t_packages, f_trademodeid, f_freedays, f_begindate, f_enddate, f_billstatus, del_flag, create_by, create_time, update_by, update_time, remark from t_warehouse_agreement
+        select f_id, f_billno,f_contractno, f_deptid, f_corpid, f_stltypeid, f_feetypeid, t_packages, f_trademodeid, f_freedays, f_begindate, f_enddate, f_billstatus, del_flag, create_by, create_time, update_by, update_time, remark from t_warehouse_agreement
     </sql>
 
     <select id="selectTWarehouseAgreementList" parameterType="TWarehouseAgreement"
@@ -50,7 +52,7 @@
     </select>
 
     <select id="selectTWarehouseAgreementList1" parameterType="TWarehouseAgreement"
-            resultMap="TWarehouseAgreementResult">
+            resultType="Map" >
         SELECT DISTINCT
                 agre.f_id AS fId,
                 corp.f_name AS fCorpid,
@@ -66,8 +68,10 @@
                 LEFT JOIN t_goods goods ON goods.f_id = agre.f_goodsid
         <where>
             <if test="fBillno != null  and fBillno != ''">and agre.f_billno = #{fBillno}</if>
+            <if test="fContractno != null  and fContractno != ''">and agre.f_contractno = #{fContractno}</if>
             <if test="fDeptid != null ">and agre.f_deptid = #{fDeptid}</if>
             <if test="fCorpid != null ">and agre.f_corpid = #{fCorpid}</if>
+            <if test="fGoodsid != null">and agre.f_goodsid = #{fGoodsid}</if>
             <if test="fStltypeid != null ">and agre.f_stltypeid = #{fStltypeid}</if>
             <if test="fFeetypeid != null ">and agre.f_feetypeid = #{fFeetypeid}</if>
             <if test="tPackages != null  and tPackages != ''">and agre.t_packages = #{tPackages}</if>
@@ -89,8 +93,10 @@
         insert into t_warehouse_agreement
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="fBillno != null and fBillno != ''">f_billno,</if>
+            <if test="fContractno != null and fContractno != ''">f_contractno,</if>
             <if test="fDeptid != null">f_deptid,</if>
             <if test="fCorpid != null">f_corpid,</if>
+            <if test="fGoodsid != null">f_goodsid,</if>
             <if test="fStltypeid != null">f_stltypeid,</if>
             <if test="fFeetypeid != null">f_feetypeid,</if>
             <if test="tPackages != null">t_packages,</if>
@@ -108,8 +114,10 @@
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="fBillno != null and fBillno != ''">#{fBillno},</if>
+            <if test="fContractno != null and fContractno != ''">#{fContractno},</if>
             <if test="fDeptid != null">#{fDeptid},</if>
             <if test="fCorpid != null">#{fCorpid},</if>
+            <if test="fGoodsid != null">#{fGoodsid},</if>
             <if test="fStltypeid != null">#{fStltypeid},</if>
             <if test="fFeetypeid != null">#{fFeetypeid},</if>
             <if test="tPackages != null">#{tPackages},</if>
@@ -131,8 +139,10 @@
         update t_warehouse_agreement
         <trim prefix="SET" suffixOverrides=",">
             <if test="fBillno != null and fBillno != ''">f_billno = #{fBillno},</if>
+            <if test="fContractno != null and fContractno != ''">f_billno = #{fContractno},</if>
             <if test="fDeptid != null">f_deptid = #{fDeptid},</if>
             <if test="fCorpid != null">f_corpid = #{fCorpid},</if>
+            <if test="fGoodsid != null">f_goodsid = #{fGoodsid},</if>
             <if test="fStltypeid != null">f_stltypeid = #{fStltypeid},</if>
             <if test="fFeetypeid != null">f_feetypeid = #{fFeetypeid},</if>
             <if test="tPackages != null">t_packages = #{tPackages},</if>

+ 2 - 1
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsMapper.xml

@@ -46,6 +46,7 @@
         <result property="fBillstatus" column="f_billstatus"/>
         <result property="delFlag" column="del_flag"/>
         <result property="createBy" column="create_by"/>
+        <result property="fItemsStatus" column="f_items_status"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
@@ -53,7 +54,7 @@
     </resultMap>
 
     <sql id="selectTWarehousebillsVo">
-        select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_marks, f_tel, f_chargedate, f_corpid, f_tocorpid, f_stltypeid, f_bscorpno, f_warehouseid, f_storekeeper, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight, f_volumn, f_trademodeid, f_billingway, f_sbu, f_feetunit, f_mblno, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid, f_billtype, f_billstatus, del_flag, create_by, create_time, update_by, update_time, remark from t_warehousebills
+        select f_id, f_billno, f_customsdeclartion, f_originalbillno, f_deptid, f_bsdeptid, f_contacts, f_marks, f_tel, f_chargedate, f_corpid, f_tocorpid, f_stltypeid, f_items_status,f_bscorpno, f_warehouseid, f_storekeeper, f_bsdate, f_planqty, f_plangrossweight, f_plannetweight, f_planvolumn, f_qty, f_grossweight, f_netweight, f_volumn, f_trademodeid, f_billingway, f_sbu, f_feetunit, f_mblno, f_vslvoy, f_eta, f_customno, f_ifweigh, f_ifpledge, f_ifdamage, f_bankcorpid, f_billtype, f_billstatus, del_flag, create_by, create_time, update_by, update_time, remark from t_warehousebills
     </sql>
 
     <select id="selectTWarehousebillsList" parameterType="TWarehousebills" resultMap="TWarehousebillsResult">