Forráskód Böngészése

出库管理优化

1 éve
szülő
commit
70cc378d5c

+ 3 - 1
platform-dao/src/main/java/com/platform/dao/enums/OutStoreStatusEnum.java

@@ -35,7 +35,9 @@ public enum OutStoreStatusEnum {
     /**
      * 已完成
      */
-    FINISH(5);
+    FINISH(5),
+
+    DELETE(6);
     private final Integer value;
 
 }

+ 5 - 19
platform-dao/src/main/resources/mapper/store/OutStoreFormMapper.xml

@@ -133,6 +133,9 @@ outstoreform.process_instance_id,
         <if test="status!=null">
             and outstoreform.status=#{status}
         </if>
+        <if test="yyId!=null and yyId!=''">
+            and outstoreform.yy_id = #{yyId}
+        </if>
     </sql>
     <!--<select id="selectList" parameterType="com.platform.dao.dto.store.OutStoreFormDTO"
             resultType="com.platform.dao.vo.query.store.OutStoreFormVO">
@@ -157,29 +160,12 @@ outstoreform.process_instance_id,
         select outstoreform.*,repairForm.no as repairNo
         from t_out_store_form as outstoreform left join t_repair_application_form repairForm on outstoreform.pick_id=repairForm.id
         <where>
+        and outstoreform.status!=6
+
             <include refid="List_Condition"/>
             <if test="userId != null and userId != ''">
                 and outstoreform.created_user_id = #{userId}
             </if>
-            <if test="yyId!=null and yyId!=''">
-                and outstoreform.yy_id = #{yyId}
-            </if>
-            <if test="applyDept!=null and applyDept!=''">
-                and outstoreform.apply_dept = #{applyDept}
-            </if>
-            <if test="status!=null">
-                and outstoreform.status = #{status}
-            </if>
-            <if test="searchTimeStart!=null">
-                and outstoreform.user_time <![CDATA[ >= ]]> #{searchTimeStart}
-            </if>
-            <if test="searchTimeEnd!=null">
-                and outstoreform.user_time <![CDATA[ <= ]]> #{searchTimeEnd}
-            </if>
-            <if test="type!=null">
-                and outstoreform.type = #{type}
-            </if>
-
         </where>
     </select>
 

+ 17 - 13
platform-service/src/main/java/com/platform/service/store/impl/OutStoreFormServiceImpl.java

@@ -186,22 +186,26 @@ public class OutStoreFormServiceImpl extends BaseServiceImpl<OutStoreFormMapper,
             throw new BusinessException("已出库的不可以删除,出库单id:" + form.getId());
         }
         // 刪除出库单
-        int result = mapper.deleteByPrimaryKey(id);
+//        int result = mapper.deleteByPrimaryKey(id);
+        OutStoreForm outStoreForm = new OutStoreForm();
+        outStoreForm.setId(id);
+        outStoreForm.setStatus(OutStoreStatusEnum.DELETE.getValue());
+        mapper.updateByPrimaryKeySelective(outStoreForm);
         UserInfo userInfo = SecurityUtils.getUserInfo();
 
         // 刪除详情,更新详情涉及的库存
-        if (result == 1) {
-            Weekend<OutStoreDetail> detailWeekend = new Weekend<>(OutStoreDetail.class);
-            detailWeekend.weekendCriteria().andEqualTo(OutStoreDetail::getOutId, id);
-            List<OutStoreDetail> detailList = detailMapper.selectByExample(detailWeekend);
-
-            // 批量删除出库详情
-            List<String> ids = detailList.stream().map(OutStoreDetail::getId).collect(Collectors.toList());
-            Weekend<OutStoreDetail> weekend = new Weekend<>(OutStoreDetail.class);
-            WeekendCriteria<OutStoreDetail, Object> weekendCriteria = weekend.weekendCriteria();
-            weekendCriteria.andIn(OutStoreDetail::getId, ids);
-            int deleteNum = detailMapper.deleteByExample(weekend);
-        }
+//        if (result == 1) {
+//            Weekend<OutStoreDetail> detailWeekend = new Weekend<>(OutStoreDetail.class);
+//            detailWeekend.weekendCriteria().andEqualTo(OutStoreDetail::getOutId, id);
+//            List<OutStoreDetail> detailList = detailMapper.selectByExample(detailWeekend);
+//
+//            // 批量删除出库详情
+//            List<String> ids = detailList.stream().map(OutStoreDetail::getId).collect(Collectors.toList());
+//            Weekend<OutStoreDetail> weekend = new Weekend<>(OutStoreDetail.class);
+//            WeekendCriteria<OutStoreDetail, Object> weekendCriteria = weekend.weekendCriteria();
+//            weekendCriteria.andIn(OutStoreDetail::getId, ids);
+//            int deleteNum = detailMapper.deleteByExample(weekend);
+//        }
         return true;
     }