guoyujia há 3 dias atrás
pai
commit
a9bef3da83

+ 10 - 3
src/main/java/cn/ezhizao/project/business/controller/BizTakeStockPeriodController.java

@@ -77,6 +77,7 @@ public class BizTakeStockPeriodController extends BaseController
     @Log(title = "查询盘点时间列表", businessType = BusinessType.SELECT)
     public TableDataInfo list(BizTakeStockPeriod bizTakeStockPeriod) throws NoSuchFieldException, IllegalAccessException
     {
+        setTenantId(bizTakeStockPeriod);
         List<BizTakeStockPeriod> allList = bizTakeStockPeriodService.query().list();
         boolean hasTakeStockStatus = allList.stream().anyMatch(item -> item.getStatus() == 1);
         boolean hasAddTakeStockStatus = allList.stream().anyMatch(item -> item.getStatus() == 0);
@@ -139,6 +140,10 @@ public class BizTakeStockPeriodController extends BaseController
     @PostMapping
     public AjaxResult add(@RequestBody BizTakeStockPeriod bizTakeStockPeriod) throws NoSuchFieldException, IllegalAccessException
     {
+        setTenantId(bizTakeStockPeriod);
+        if(bizTakeStockPeriod.getTenantId() == 0L) {
+            return error("未识别到厂别");
+        }
         bizTakeStockPeriodService.saveOrUpdate(bizTakeStockPeriod);
         return success();
     }
@@ -160,6 +165,7 @@ public class BizTakeStockPeriodController extends BaseController
     @PutMapping
     @Transactional
     public AjaxResult edit(@RequestBody BizTakeStockPeriod bizTakeStockPeriod) throws NoSuchFieldException, IllegalAccessException, SQLException {
+        setTenantId(bizTakeStockPeriod);
         if(bizTakeStockPeriod.getFlag() !=null) {
             bizTakeStockPeriod.setStatus(1);
         }
@@ -170,7 +176,7 @@ public class BizTakeStockPeriodController extends BaseController
             //扩大连接池
             bizTakeStockPeriodService.updateDruidPoolSize(5000);
             //已生产的批次
-            List<BizDaywork> dayworkList = bizDayworkService.selectNeedTakeStock();
+            List<BizDaywork> dayworkList = bizDayworkService.selectNeedTakeStock(bizTakeStockPeriod.getTenantId());
             List<BizTaksStockLot> list = new ArrayList<>();
             dayworkList.forEach(item -> {
 //                BizDayworkItem conditions = new BizDayworkItem();
@@ -217,7 +223,7 @@ public class BizTakeStockPeriodController extends BaseController
                 list.add(bizTaksStockLot);
             });
             //未生产的批次
-            List<BizLot> bizLots = bizLotService.selectNeedTakeStock();
+            List<BizLot> bizLots = bizLotService.selectNeedTakeStock(bizTakeStockPeriod.getTenantId());
             bizLots.forEach(item -> {
                 BizTaksStockLot bizTaksStockLot = new BizTaksStockLot();
                 bizTaksStockLot.setStockYear(bizTakeStockPeriod.getStockYear());
@@ -247,12 +253,13 @@ public class BizTakeStockPeriodController extends BaseController
             });
             bizTaksStockLotService.saveBatch(list);
             //保存盘点零存库
-            List<BizStorageRetrieval> notRetrievalList = bizStorageRetrievalService.query().eq("status", 0).list();
+            List<BizStorageRetrieval> notRetrievalList = bizStorageRetrievalService.query().eq("status", 0).eq("tenant_id", bizTakeStockPeriod.getTenantId()).list();
             if(notRetrievalList.size()>0) {
                 List<BizTaksStockStorageRetrieval> needAddList = new ArrayList<>();
                 notRetrievalList.forEach(item ->{
                     BizTaksStockStorageRetrieval newItem = new BizTaksStockStorageRetrieval();
                     newItem.setStatus(item.getStatus());
+                    newItem.setTenantId(item.getTenantId());
                     newItem.setTakeStockPeriodId(bizTakeStockPeriod.getId());
                     newItem.setProductionPlanDetailId(item.getProductionPlanDetailId());
                     newItem.setProductDescription(item.getProductDescription());

+ 1 - 0
src/main/java/cn/ezhizao/project/business/domain/BizTakeStockPeriod.java

@@ -57,4 +57,5 @@ public class BizTakeStockPeriod extends BaseEntity
     private String stockTime;
     @TableField(exist = false)
     private String flag;
+    private Long tenantId;
 }

+ 1 - 1
src/main/java/cn/ezhizao/project/business/mapper/BizDayworkMapper.java

@@ -24,7 +24,7 @@ public interface BizDayworkMapper extends BaseMapper<BizDaywork> {
      * @return 报工集合
      */
     public List<BizDaywork> getList(BizDaywork bizDaywork);
-    public List<BizDaywork> selectNeedTakeStock();
+    public List<BizDaywork> selectNeedTakeStock(Long tenantId);
     public List<BizDaywork> getListForOutsource(BizDaywork bizDaywork);
     public List<BizDaywork> getListForInnerOutsource(BizDaywork bizDaywork);
 

+ 1 - 1
src/main/java/cn/ezhizao/project/business/mapper/BizLotMapper.java

@@ -29,7 +29,7 @@ public interface BizLotMapper extends BaseMapper<BizLot> {
      * @return 生产计划明细集合
      */
     public List<BizLot> getList(BizLot data);
-    public List<BizLot> selectNeedTakeStock();
+    public List<BizLot> selectNeedTakeStock(Long tenantId);
 
     /**
      * 查询生产计划明细列表

+ 1 - 1
src/main/java/cn/ezhizao/project/business/service/IBizDayworkService.java

@@ -31,7 +31,7 @@ public interface IBizDayworkService extends IService<BizDaywork> {
      * @return 报工集合
      */
     List<BizDaywork> getListForAuxiliary(BizDaywork bizDaywork);
-    List<BizDaywork> selectNeedTakeStock();
+    List<BizDaywork> selectNeedTakeStock(Long tenantId);
 
     /**
      * 查询报工信息,非本序废品使用

+ 1 - 1
src/main/java/cn/ezhizao/project/business/service/IBizLotService.java

@@ -21,7 +21,7 @@ public interface IBizLotService extends IService<BizLot>
      * @return 生产计划明细集合
      */
     List<BizLot> getNotStartList(BizProductionPlanDetail data);
-    List<BizLot> selectNeedTakeStock();
+    List<BizLot> selectNeedTakeStock(Long tenantId);
      List<BizLot> getAllLot(Long id);
 
     /**

+ 2 - 2
src/main/java/cn/ezhizao/project/business/service/impl/BizDayworkServiceImpl.java

@@ -42,8 +42,8 @@ public class BizDayworkServiceImpl extends ServiceImpl<BizDayworkMapper, BizDayw
     }
 
     @Override
-    public List<BizDaywork> selectNeedTakeStock() {
-        return bizDayworkMapper.selectNeedTakeStock();
+    public List<BizDaywork> selectNeedTakeStock(Long tenantId) {
+        return bizDayworkMapper.selectNeedTakeStock(tenantId);
     }
 
     @Override

+ 2 - 2
src/main/java/cn/ezhizao/project/business/service/impl/BizLotServiceImpl.java

@@ -33,8 +33,8 @@ public class BizLotServiceImpl extends ServiceImpl<BizLotMapper, BizLot> impleme
     }
 
     @Override
-    public List<BizLot> selectNeedTakeStock() {
-        return bizLotMapper.selectNeedTakeStock();
+    public List<BizLot> selectNeedTakeStock(Long tenantId) {
+        return bizLotMapper.selectNeedTakeStock(tenantId);
     }
 
     @Override

+ 2 - 1
src/main/resources/mybatis/business/BizDayworkMapper.xml

@@ -448,7 +448,8 @@
         biz_daywork t1 left join biz_production_plan_detail t3 on t1.production_plan_detail_id = t3.id
         left join biz_lot t7 on t7.id = t1.lot_id
         WHERE
-        t1.deleted = 0;
+        t1.deleted = 0
+        <if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
     </select>
 
     <select id="getListFromNoCurrent" resultMap="BizDayworkResult">

+ 1 - 0
src/main/resources/mybatis/business/BizLotMapper.xml

@@ -170,6 +170,7 @@
         select t1.*,t2.product_description as description,t2.requisition_department_id as dept_id,t2.drawing_number as drawingNumberName  from biz_lot t1
         left join biz_production_plan_detail t2 on t1.production_plan_detail_id = t2.id
         where t1.id not in (select lot_id from biz_daywork where deleted = 0) and t1.deleted = 0 and t1.deleted = 0
+        <if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
     </select>
     <select id="getLotWaste" resultType="cn.ezhizao.project.business.domain.BizLotWaste">
         select * from biz_lot_waste t1 where t1.lot_id = #{lotId} and t1.deleted = 0

+ 1 - 0
src/main/resources/mybatis/business/BizTakeStockPeriodMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
             deleted = 0
             <if test="status != null "> AND status = #{status}</if>
+            <if test="tenantId != null and tenantId!= 0"> AND tenant_id = #{tenantId}</if>
             <if test="remark != null "> AND remark like concat('%',#{remark},'%')</if>
             <if test="createStartTime != null ">AND create_time &gt; #{createStartTime}</if>
             <if test="createEndTime != null ">AND create_time &lt; #{createEndTime}</if>