Bläddra i källkod

Merge remote-tracking branch 'origin/250217外协发出一键选择工序,报工维护修改,分选包装后自动周转' into 250217外协发出一键选择工序,报工维护修改,分选包装后自动周转

ezhizao_zx 4 månader sedan
förälder
incheckning
6d7b1c78ef

+ 8 - 2
src/main/java/cn/ezhizao/project/business/controller/BizOutsourcedOrderController.java

@@ -514,9 +514,15 @@ public class BizOutsourcedOrderController extends BaseController {
     }
 
     //    @PreAuthorize("@ss.hasPermi('business:outsource:query')")
-    @GetMapping(value = "/carrierForOutsource")
+    @PostMapping(value = "/carrierForOutsource")
     @Log(title = "获取外协箱列表", businessType = BusinessType.SELECT)
-    public TableDataInfo carrierForOutsource(BizCarrier carrier) {
+    public TableDataInfo carrierForOutsource(@RequestBody BizCarrier carrier) {
+        if(carrier.getHasAddCarrierIds() != null && carrier.getHasAddCarrierIds().size() > 0){
+            List<BizCarrier> notMoreCarrier = bizCarrierService.getNotMoreCarrier(carrier.getHasAddCarrierIds());
+            if(!notMoreCarrier.isEmpty()){
+                carrier.setHasAddCarrierIds(notMoreCarrier.stream().map(BizCarrier::getId).collect(Collectors.toList()));
+            }
+        }
         carrier.setNotInUse(1);
         carrier.setIsAllowMore(0);
         List<BizCarrier> list = bizCarrierService.getListFromOutsource(carrier);

+ 3 - 0
src/main/java/cn/ezhizao/project/business/domain/BizCarrier.java

@@ -10,6 +10,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 
 
 /**
@@ -88,4 +89,6 @@ public class BizCarrier extends BaseEntity {
     @TableField(exist = false)
     private Long lotId;
     private Integer isInspection;
+    @TableField(exist = false)
+    private List<Long> hasAddCarrierIds;
 }

+ 2 - 0
src/main/java/cn/ezhizao/project/business/mapper/BizCarrierMapper.java

@@ -3,6 +3,7 @@ package cn.ezhizao.project.business.mapper;
 import cn.ezhizao.project.business.domain.BizCarrier;
 import cn.ezhizao.project.business.domain.BizCarrierCategory;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -34,6 +35,7 @@ public interface BizCarrierMapper extends BaseMapper<BizCarrier> {
     List<BizCarrier> getListFromOutsource(BizCarrier carrier);
 
     List<BizCarrier> getSpecialList(BizCarrier bizCarrier);
+    List<BizCarrier> getNotMoreCarrier(@Param("hasAddCarrierIds") List<Long> ids);
 
     BizCarrierCategory getCarrierCategory(Long categoryId);
 }

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

@@ -34,6 +34,7 @@ public interface IBizCarrierService extends IService<BizCarrier> {
     List<BizCarrier> getSpecialList(BizCarrier bizCarrier);
 
     List<BizCarrier> getListFromOutsource(BizCarrier carrier);
+    List<BizCarrier> getNotMoreCarrier(List<Long> ids);
 
     BizCarrierCategory getCarrierCategory(Long categoryId);
 }

+ 5 - 0
src/main/java/cn/ezhizao/project/business/service/impl/BizCarrierServiceImpl.java

@@ -66,6 +66,11 @@ public class BizCarrierServiceImpl extends ServiceImpl<BizCarrierMapper, BizCarr
         return bizCarrierMapper.getListFromOutsource(carrier);
     }
 
+    @Override
+    public List<BizCarrier> getNotMoreCarrier(List<Long> ids) {
+        return bizCarrierMapper.getNotMoreCarrier(ids);
+    }
+
     @Override
     public BizCarrierCategory getCarrierCategory(Long categoryId) {
         return bizCarrierMapper.getCarrierCategory(categoryId);

+ 13 - 1
src/main/resources/mybatis/business/BizCarrierMapper.xml

@@ -25,6 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
         </trim>
     </select>
+    <select id="getNotMoreCarrier" resultMap="BizCarrierResult">
+        select t1.* from biz_carrier t1 left join biz_carrier_category t2 on t1.category_id = t2.id where t1.deleted = 0 and t2.deleted = 0 and t2.is_allow_more = 0
+        and t1.id IN
+        <foreach item="id" index="index" collection="hasAddCarrierIds" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
 
     <select id="getListNotInspectionList" resultMap="BizCarrierResult" parameterType="cn.ezhizao.project.business.domain.BizCarrier">
         select t1.id,t1.category_id,t1.code,t1.qc_code,t1.remark,t1.tenant_id,t1.is_allow_more,t1.is_inspection,COALESCE((SELECT t2.is_abandoned FROM biz_carrier_reject t2 WHERE t1.id = t2.carrier_id ORDER BY t2.create_time DESC LIMIT 1), 0) AS is_abandoned
@@ -81,7 +88,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="notInUse == 1">
                 AND not exists (select 1 from biz_daywork_carrier t where t.is_changed = 0 and t.carrier_id = t1.id and t.daywork_id != #{dayworkId})
             </if>
-
+            <if test="hasAddCarrierIds != null and hasAddCarrierIds.size()>0">
+               and t1.id NOT IN
+                <foreach item="id" index="index" collection="hasAddCarrierIds" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
         </trim>
     </select>
 

+ 3 - 3
src/main/resources/mybatis/business/BizDayworkMapper.xml

@@ -474,10 +474,10 @@
         ) AS original_carrier
         FROM biz_daywork t1
         LEFT JOIN biz_product t2 ON t1.product_id = t2.id
-        LEFT JOIN biz_technological_process t3 ON t1.technological_process_id=t3.id
+        LEFT JOIN biz_lot t3 ON t1.lot_id=t3.id
         left join biz_production_plan_detail t4 on t1.production_plan_detail_id = t4.id
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
-            t1.deleted = 0
+            t1.deleted = 0 and t3.deleted = 0
             <if test="tenantId != null and tenantId != 0">AND t1.tenant_id = #{tenantId}</if>
             <if test="dayworkIds != null and dayworkIds.size > 0">
                 AND t1.id IN
@@ -525,7 +525,7 @@
         ) AS original_carrier
         FROM biz_daywork t1
         LEFT JOIN biz_product t2 ON t1.product_id = t2.id
-        LEFT JOIN biz_technological_process t3 ON t1.technological_process_id=t3.id
+        LEFT JOIN biz_lot t3 ON t1.lot_id=t3.id
         left join biz_production_plan_detail t4 on t1.production_plan_detail_id = t4.id
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
             t1.deleted = 0