Explorar el Código

大库位和小库位同时修改状态

oyq28 hace 1 año
padre
commit
ee9a1c2bca

+ 4 - 0
src/main/java/com/imcs/admin/business/dao/WStorageLocationManagementDao.java

@@ -15,5 +15,9 @@ public interface WStorageLocationManagementDao extends BaseMapper<WStorageLocati
 
     void updateByLocationCode(@Param("status") int status, @Param("locationCode") String endPosition);
 
+    void updateByParentId(@Param("status") int status, @Param("parentId") Long parentId);
+
     List<WStorageLocationManagement> getAllByLocationCode(List<WInventoryManagement> wInventoryManagements);
+
+    void updateStatusById(@Param("status") int status, @Param("locationCode") String locationCode);
 }

+ 12 - 1
src/main/java/com/imcs/admin/business/service/impl/BaseServiceImpl.java

@@ -53,7 +53,18 @@ public class BaseServiceImpl {
      */
     @Transactional
     public void updateStorageStatus(int status,String locationCode){
-        storageLocationDao.updateByLocationCode(status,locationCode);
+        LambdaQueryWrapper<WStorageLocationManagement> wrapper = Wrappers.lambdaQuery(WStorageLocationManagement.class).eq(WStorageLocationManagement::getLocationCode,locationCode);
+        WStorageLocationManagement wStorageLocationManagement = storageLocationDao.selectOne(wrapper);
+        //大库位 把大库位和所有小库位都设置为预占用
+        if(wStorageLocationManagement.getPalletType() == 1){
+            storageLocationDao.updateByLocationCode(status,locationCode);
+            storageLocationDao.updateByParentId(status,wStorageLocationManagement.getId());
+        }else{
+            //小库位  把大库位和所小库位都设置为预占用
+            storageLocationDao.updateByLocationCode(status,locationCode);
+            storageLocationDao.updateStatusById(status,locationCode);
+        }
+
     }
 
 

+ 10 - 2
src/main/resources/mapper/WStorageLocationDao.xml

@@ -16,8 +16,16 @@
     </select>
 
 
-    <update id="updateByLocationCode">
-        update w_storage_location_management set storage_location_status=#{status} where location_code=#{locationCode}
+    <update id="updateByLocationCode" >
+        update w_storage_location_management set storage_location_status=#{status} where location_code=#{locationCode};
+    </update>
+
+    <update id="updateByParentId">
+        update w_storage_location_management set storage_location_status=#{status} where parent_id=#{parentId};
+    </update>
+    <update id="updateStatusById">
+        update w_storage_location_management set storage_location_status=#{status}
+        where id = (select parent_id from w_storage_location_management where location_code=#{locationCode}  )
     </update>
 
     <select id="getAllByLocationCode" resultType="com.imcs.admin.entity.WStorageLocationManagement" parameterType="com.imcs.admin.entity.WInventoryManagement">