ccjgmwz 3 年 前
コミット
57a6b3c65e

+ 3 - 3
pom.xml

@@ -184,9 +184,6 @@
             <properties>
                 <env>local</env>
             </properties>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
         </profile>
         <profile>
             <id>dev</id>
@@ -205,6 +202,9 @@
             <properties>
                 <env>prod</env>
             </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
         </profile>
     </profiles>
     <build>

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

@@ -66,6 +66,14 @@ public class WarehouseBaseInfoController {
     public List<WarehouseBaseInfo> selectWarehouseSelf(@RequestParam String compId,String personCharge){
         return warehouseBaseInfoService.selectWarehouseSelf(compId,personCharge);
     }
+    /**
+     * 查看自己负责的常用仓库
+     * 公司ID,手机号
+     */
+    @GetMapping("/selectWarehouseSelfApp")
+    public List<WarehouseBaseInfo> selectWarehouseSelfApp(@RequestParam String compId,String personCharge){
+        return warehouseBaseInfoService.selectWarehouseSelfApp(compId,personCharge);
+    }
     /**
      * 查看库房
      */

+ 6 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IWarehouseBaseInfoService.java

@@ -91,6 +91,12 @@ public interface IWarehouseBaseInfoService extends IService<WarehouseBaseInfo> {
      * @return
      */
     List<WarehouseBaseInfo> selectWarehouseSelf(String compId,String personCharge);
+    /**
+     * 查看自己负责的常用仓库
+     * @param compId
+     * @return
+     */
+    List<WarehouseBaseInfo> selectWarehouseSelfApp(String compId,String personCharge);
     /**
      * 获取打印数据
      * @param id

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

@@ -993,6 +993,102 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
         }
     }
 
+    /**
+     * 查看自己负责的常用仓库
+     * @param compId
+     * @param personCharge
+     * @return
+     */
+    @Override
+    public List<WarehouseBaseInfo> selectWarehouseSelfApp(String compId, String personCharge) {
+        if(compId == null || compId.isEmpty()){
+            compId = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getCompId();
+        }
+        if(personCharge == null || personCharge.isEmpty()){
+            personCharge = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffMobilePhone();
+        }
+        Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
+                warehouseBaseInfoWrapper.eq("comp_id", compId).eq("delete_flag", "0");
+        warehouseBaseInfoWrapper.andNew().eq("person_phone", personCharge).or()
+                .like("other_person_charge", personCharge);
+        List<WarehouseBaseInfo> warehouseBaseInfoList=this.selectList(warehouseBaseInfoWrapper);
+        if (!CollectionUtils.isEmpty(warehouseBaseInfoList)){
+            for (WarehouseBaseInfo warehouseBaseInfo:warehouseBaseInfoList) {
+                //查潮粮单价已审核的数据
+//                List<PurchasePrice> purchasePriceList=purchasePriceService.selectList(new EntityWrapper<PurchasePrice>()
+//                        .eq("warehouse_id",warehouseBaseInfo.getId())
+//                        .eq("status_flag","3"));
+//                if (!CollectionUtils.isEmpty(purchasePriceList)){
+//                    warehouseBaseInfo.setPurchasePriceList(purchasePriceList);
+//                }
+                Map<String, Object> pageView = new HashMap<>();
+                pageView.put("warehouseName", warehouseBaseInfo.getWarehouseName());
+                pageView.put("compId", warehouseBaseInfo.getCompId());
+                // 查询质检信息包括已删除的
+                Integer dataCount = baseMapper.getCountByCondition(pageView);
+                warehouseBaseInfo.setCount(dataCount);
+            }
+        }
+        else {
+            String staffId = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffId();
+            List<CommonStaffRole> staffRoles = commonStaffRoleService.selectList(new EntityWrapper<CommonStaffRole>().eq("staff_id",staffId));
+            List<CommonRole> list = new ArrayList<>();
+            for(CommonStaffRole commonStaffRole : staffRoles){
+                list.add(commonRoleService.selectById(commonStaffRole.getRoleId()));
+            }
+            for(CommonRole commonRole : list){
+                if(commonRole.getRoleName().equals("内勤") || commonRole.getRoleName().equals("决策人") || commonRole.getRoleName().equals("财务")|| commonRole.getRoleName().equals("出纳")|| commonRole.getRoleName().equals("系统管理员")|| commonRole.getRoleName().contains("总")){
+                    List<WarehouseBaseInfo> warehouseBaseInfoList1 = this.selectList(new EntityWrapper<WarehouseBaseInfo>()
+                            .eq("comp_id", compId)
+                            .eq("delete_flag", "0"));
+                    for (WarehouseBaseInfo warehouseBaseInfo:warehouseBaseInfoList1){
+                        warehouseBaseInfo.setFlag("全部");
+                        //查潮粮单价已审核的数据
+//                        List<PurchasePrice> purchasePriceList=purchasePriceService.selectList(new EntityWrapper<PurchasePrice>()
+//                                .eq("warehouse_id",warehouseBaseInfo.getId())
+//                                .eq("status_flag","3"));
+//                        if (!CollectionUtils.isEmpty(purchasePriceList)){
+//                            warehouseBaseInfo.setPurchasePriceList(purchasePriceList);
+//                        }
+                        Map<String, Object> pageView = new HashMap<>();
+                        pageView.put("warehouseName", warehouseBaseInfo.getWarehouseName());
+                        pageView.put("compId", warehouseBaseInfo.getCompId());
+                        // 查询质检信息包括已删除的
+                        Integer dataCount = baseMapper.getCountByCondition(pageView);
+                        warehouseBaseInfo.setCount(dataCount);
+                        warehouseBaseInfoList.add(warehouseBaseInfo);
+                    }
+                    break;
+//                    return warehouseBaseInfoList;
+                }
+            }
+        }
+        if (!CollectionUtils.isEmpty(warehouseBaseInfoList)) {
+            for (WarehouseBaseInfo warehouseBaseInfo : warehouseBaseInfoList) {
+                List<WarehousePositionStorageInfo> temp = new ArrayList();
+                // 以库位为维度查询
+                List<WarehousePositionInfo> warehousePositionInfos = warehousePositionInfoService.selectList(new EntityWrapper<WarehousePositionInfo>()
+                        .eq("base_id", warehouseBaseInfo.getId()));
+                if (!CollectionUtils.isEmpty(warehousePositionInfos)) {
+                    for (WarehousePositionInfo warehousePositionInfo:warehousePositionInfos) {
+                        //查询仓库内的货名
+                        List<WarehousePositionStorageInfo> warehousePositionStorageInfos = warehousePositionStorageInfoService.selectList(new EntityWrapper<WarehousePositionStorageInfo>()
+                                .eq("position_id", warehousePositionInfo.getId()));
+                        if (!CollectionUtils.isEmpty(warehousePositionStorageInfos)){
+                            for (WarehousePositionStorageInfo warehousePositionStorageInfo:warehousePositionStorageInfos){
+                                temp.add(warehousePositionStorageInfo);
+                            }
+                        }
+                    }
+                    warehouseBaseInfo.setGoodsNameInfos(temp);
+                    warehouseBaseInfo.setPositionInfos(warehousePositionInfos);
+                }
+            }
+
+        }
+        return warehouseBaseInfoList;
+    }
+
     /**
      * 查看自己负责的常用仓库
      * @param compId
@@ -1008,7 +1104,7 @@ public class WarehouseBaseInfoServiceImpl extends ServiceImpl<WarehouseBaseInfoM
             personCharge = AuthSecurityUtils.getStaffById(AuthSecurityUtils.getCurrentUserId()).getStaffMobilePhone();
         }
         Wrapper<WarehouseBaseInfo> warehouseBaseInfoWrapper = new EntityWrapper<>();
-                warehouseBaseInfoWrapper.eq("comp_id", compId)
+        warehouseBaseInfoWrapper.eq("comp_id", compId)
                 .eq("warehouse_type","1").eq("delete_flag", "0");
         warehouseBaseInfoWrapper.andNew().eq("person_phone", personCharge).or()
                 .like("other_person_charge", personCharge);

+ 11 - 37
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/WarehouseInOutInfoServiceImpl.java

@@ -1164,43 +1164,17 @@ public class WarehouseInOutInfoServiceImpl extends ServiceImpl<WarehouseInOutInf
                             warehouseInOutInfo.setWeightedCost(costManagementInfo.getCost());
                             warehouseInOutInfoService.updateById(warehouseInOutInfo);
                         }
-                        //定义入库
-                        String inNetWeight = "";
-                        // 查询入库量
-                        List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
-                                .eq("base_id", warehouseInOutInfo.getBaseId()).eq("in_out_flag", "2").eq("goods_name", warehouseInOutInfo.getGoodsName()));
-                        if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
-                            for (WarehouseInOutInfo warehouseInOutInfos : warehouseInOutInfoList) {
-                                if (StringUtils.isEmpty(inNetWeight)) {
-                                    inNetWeight = "0";
-                                }
-                                inNetWeight = String.valueOf(Float.valueOf(inNetWeight) + warehouseInOutInfos.getNetWeight());
-                            }
-                        }
-                        //定义出库量
-                        String outNetWeight = "";
-                        // 查询出库量
-                        List<WarehouseInOutInfo> warehouseInOutInfo1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
-                                .eq("base_id", warehouseInOutInfo.getBaseId()).eq("in_out_flag", "1")
-                                .eq("goods_name", warehouseInOutInfo.getGoodsName()));
-                        //有出库记录
-                        if (!CollectionUtils.isEmpty(warehouseInOutInfo1)) {
-                            for (WarehouseInOutInfo warehouseInOutInfos : warehouseInOutInfo1) {
-                                if (StringUtils.isEmpty(outNetWeight)) {
-                                    outNetWeight = "0";
-                                }
-                                outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + warehouseInOutInfos.getNetWeight());
-                            }
-                            outNetWeight = String.valueOf(Float.valueOf(outNetWeight) + warehouseInOutInfo.getNetWeight());
-                        }
-                        //没有出库记录
-                        else {
-                            outNetWeight = String.valueOf(warehouseInOutInfo.getNetWeight());
-                        }
-                        //出库量大于入库量
-                        if ((outNetWeight.compareTo(inNetWeight)) > 0) {
-                            throw new YException(YExceptionEnum.INNETWEIGHT_NO_ERROR);
-                        }
+//                        Float storage =0f;
+//                        // 查询应余量
+//                        WarehousePositionStorageInfo warehousePositionStorageInfo = warehousePositionStorageInfoService.selectOne(new EntityWrapper<WarehousePositionStorageInfo>()
+//                                .eq("position_id", warehouseInOutInfo.getPositionId()).eq("goods_name_key", warehouseInOutInfo.getGoodsNameKey()));
+//                        if (warehousePositionStorageInfo != null) {
+//                            storage = warehousePositionStorageInfo.getStorage();
+//                        }
+//                        //出库量大于入库量
+//                        if ((warehouseInOutInfo.getNetWeight().compareTo(storage)) > 0) {
+//                            throw new YException(YExceptionEnum.INNETWEIGHT_NO_ERROR);
+//                        }
                     }
                 }
             }