Kaynağa Gözat

[CODE]: 仓库删除库区修改

maxianghua 4 yıl önce
ebeveyn
işleme
4981f8474c

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

@@ -86,12 +86,11 @@ public class TWarehouseAreaServiceImpl implements ITWarehouseAreaService {
     @Override
     @Transactional
     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()){
+            int warehousebillsitemsSize = tWarehousebillsitemsMapper.warehousebillsitemsWarehouselocidSize(id);
+            if(warehousebillsitemsSize > 0 ){
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("库区有货物不可删除");
             }

+ 13 - 6
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java

@@ -125,7 +125,7 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
                 }
             }
             tWarehouseMapper.updateTWarehouse(tWarehouses);
-            tWarehouseAreaMapper.deleteTWarehouseAreaByTWarehoused(fPid);
+            // tWarehouseAreaMapper.deleteTWarehouseAreaByTWarehoused(fPid);
         }
         for (TWarehouseArea cc : tWarehouseAreaList) {
             if( StringUtils.isNull(cc.getfNo())  ||
@@ -134,11 +134,18 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("请完善库区明细信息");
             }
-            cc.setfWarehouseid(fPid);
-            cc.setfStatus("0");
-            cc.setCreateBy(loginUser.getUser().getUserName());
-            cc.setCreateTime(new Date());
-            tWarehouseAreaMapper.insertTWarehouseArea(cc);
+            if(cc.getfId()!=null){
+                cc.setUpdateBy(loginUser.getUser().getUserName());
+                cc.setUpdateTime(new Date());
+                tWarehouseAreaMapper.updateTWarehouseArea(cc);
+            } else {
+                cc.setfWarehouseid(fPid);
+                cc.setfStatus("0");
+                cc.setCreateBy(loginUser.getUser().getUserName());
+                cc.setCreateTime(new Date());
+                tWarehouseAreaMapper.insertTWarehouseArea(cc);
+            }
+
         }
         return AjaxResult.success();
     }

+ 8 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehousebillsitemsMapper.xml

@@ -387,6 +387,14 @@
             <if test="warehouse.fMblno != null">and ware.f_mblno = #{warehouse.fMblno}</if>
         </where>
     </select>
+    <select id="warehousebillsitemsWarehouselocidSize" resultType="java.lang.Integer">
+        SELECT
+            COUNT( 1 )
+        FROM
+            t_warehousebillsitems
+        WHERE
+            f_warehouselocid = #{fWarehouselocid}
+    </select>
 
     <update id="warehouseItemFollowUpdate" parameterType="Long">
         update