Browse Source

Merge remote-tracking branch 'origin/master'

ezhizao_zx 10 tháng trước cách đây
mục cha
commit
faa55d2497

+ 2 - 2
src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkController.java

@@ -149,7 +149,6 @@ public class BizDayworkController extends BaseController {
                 return success(new ArrayList<>());
             }
         }
-
         // 获取当前用户的,针对当前部门以及当前生产计划下的报工集合
         List<BizDayworkItem> myDayworkItems = bizDayworkItemService.query()
                 .eq("dept_id", deptId)
@@ -232,7 +231,8 @@ public class BizDayworkController extends BaseController {
             // 判断最后一道报工记录的部门id,与当前登录者的部门id相同,并且状态 < 5
             // 状态 == 5 时,说明已经进入周转中,那么该条daywork,将不再页面中显示,所以,通过对status的值的判断,添加到daywork集合中
             // 最后一条非周转报工的工段为当前工段。
-            if (latestNoTurnover.getDeptId().equals(deptId) && Integer.parseInt(status) < 5 && latestProcess != null) {
+            //20240806添加isSpecial!=1将最新一条报工为特殊报工的批次删除
+            if (!latestNoTurnover.getIsSpecial().equals(1)&&latestNoTurnover.getDeptId().equals(deptId) && Integer.parseInt(status) < 5 && latestProcess != null) {
                 // 获取当前操作者自己的报工记录
                 List<BizDayworkItem> currentMyDayworkItems = myDayworkItems.stream()
                         .filter(di -> di.getDayworkId().equals(item.getId()))

+ 4 - 0
src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkItemController.java

@@ -1153,6 +1153,8 @@ public class BizDayworkItemController extends BaseController {
                 bizItem.setUserId(user.getUserId());
                 bizItem.setUserName(user.getUserName());
                 bizItem.setNickName(user.getNickName());
+                bizItem.setIsSpecial(lastItem.getIsSpecial());
+                bizItem.setSpecialIsFirst(lastItem.getSpecialIsFirst());
                 bizItem.setWorkingHours(0L);
                 bizItem.setTenantId(lastItem.getTenantId());
                 bizItem.setProductionPlanDetailId(lastItem.getProductionPlanDetailId());
@@ -1280,6 +1282,8 @@ public class BizDayworkItemController extends BaseController {
                 bizItem.setUserId(user.getUserId());
                 bizItem.setUserName(user.getUserName());
                 bizItem.setNickName(user.getNickName());
+                bizItem.setIsSpecial(lastItem.getIsSpecial());
+                bizItem.setSpecialIsFirst(lastItem.getSpecialIsFirst());
                 bizItem.setWorkingHours(0L);
                 bizItem.setDeptId(lastItem.getDeptId());
                 bizItem.setTenantId(lastItem.getTenantId());

+ 29 - 12
src/main/java/cn/ezhizao/project/business/product/controller/BizProductionPlanDetailController.java

@@ -8,6 +8,7 @@ import cn.ezhizao.framework.web.domain.AjaxResult;
 import cn.ezhizao.framework.web.page.TableDataInfo;
 import cn.ezhizao.project.business.product.domain.*;
 import cn.ezhizao.project.business.product.service.IBizDayworkService;
+import cn.ezhizao.project.business.product.service.IBizLotService;
 import cn.ezhizao.project.business.product.service.IBizProductionPlanDetailService;
 import cn.ezhizao.project.business.resourceGroup.domain.BizProductionResourceGroup;
 import cn.ezhizao.project.business.resourceGroup.domain.BizProductionResourceGroupDetail;
@@ -47,6 +48,8 @@ public class BizProductionPlanDetailController extends BaseController {
 
     @Resource
     private IBizDayworkService dayworkService;
+    @Resource
+    private IBizLotService bizLotService;
 
 
 
@@ -151,18 +154,32 @@ public class BizProductionPlanDetailController extends BaseController {
         if (planDetailIds.isEmpty()){
             return null;
         }
-
-        QueryWrapper<BizProductionPlanDetail> productionPlanDetailQueryWrapper = new QueryWrapper<>();
-        String keywords = bizProductionPlanDetail.getKeywords();
-        productionPlanDetailQueryWrapper.in("id", planDetailIds);
-        if (!Objects.equals(keywords, "")) {
-            productionPlanDetailQueryWrapper.and(item ->
-                item.like("product_description", keywords)
-                    .or()
-                    .like("production_plan_no", keywords)
-            );
-        }
-        List<BizProductionPlanDetail> list = bizProductionPlanDetailService.list(productionPlanDetailQueryWrapper);
+        //去掉已完成的计划单
+        List<Long> detailIds = new ArrayList<>();
+        List<BizLot> bizLotList = bizLotService.query().in("production_plan_detail_id", planDetailIds).eq("deleted", 0).list();
+        List<BizDaywork> dayworkList = dayworkService.query().in("production_plan_detail_id", planDetailIds).eq("status", 2).list();
+        planDetailIds.forEach(id -> {
+            long lotCount = bizLotList.stream().filter(item -> item.getProductionPlanDetailId().equals(id)).count();
+            long dayworkCount = dayworkList.stream().filter(item -> item.getProductionPlanDetailId().equals(id)).count();
+            if(lotCount > dayworkCount) {
+                detailIds.add(id);
+            }
+        });
+        BizProductionPlanDetail detail = new BizProductionPlanDetail();
+        detail.setPlanDetailIds(detailIds);
+        detail.setKeywords(bizProductionPlanDetail.getKeywords());
+        List<BizProductionPlanDetail> list = bizProductionPlanDetailService.selectNotComplatedList(detail);
+//        QueryWrapper<BizProductionPlanDetail> productionPlanDetailQueryWrapper = new QueryWrapper<>();
+//        String keywords = bizProductionPlanDetail.getKeywords();
+//        productionPlanDetailQueryWrapper.in("id", planDetailIds);
+//        if (!Objects.equals(keywords, "")) {
+//            productionPlanDetailQueryWrapper.and(item ->
+//                item.like("product_description", keywords)
+//                    .or()
+//                    .like("production_plan_no", keywords)
+//            );
+//        }
+//        List<BizProductionPlanDetail> list = bizProductionPlanDetailService.list(productionPlanDetailQueryWrapper);
         // 将获取到的ProductionPlanDetail集合的id提取到集合中
         List<Long> tempPlanDetailIds = list.stream()
                 .map(BizProductionPlanDetail::getId)

+ 9 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizDayworkItem.java

@@ -91,6 +91,15 @@ public class BizDayworkItem extends BaseEntity
     @ApiModelProperty(value = "生产状态 0:未开始, 1: 生产中, 2: 报工结束 ,3: 工序已完成, 4: 待周转,5: 周转中,6: 已送达,7:已接收")
     private String status;
 
+    /** 是否有特殊报工 */
+    @Excel(name = "是否特殊报工")
+    @ApiModelProperty(value = "是否特殊报工")
+    private Integer isSpecial;
+
+    @Excel(name = "特殊报工是否首序")
+    @ApiModelProperty(value = "特殊报工是否首序")
+    private Integer  specialIsFirst;
+
     /** 用户id */
     private Long userId;
     /** 接收人id */

+ 2 - 0
src/main/java/cn/ezhizao/project/business/product/domain/BizProductionPlanDetail.java

@@ -299,5 +299,7 @@ public class BizProductionPlanDetail extends BaseEntity {
 
     @TableField(exist = false)
     private List<Long> planIds;
+    @TableField(exist = false)
+    private List<Long> planDetailIds;
 
 }

+ 1 - 0
src/main/java/cn/ezhizao/project/business/product/mapper/BizProductionPlanDetailMapper.java

@@ -21,6 +21,7 @@ public interface BizProductionPlanDetailMapper extends BaseMapper<BizProductionP
      * @return 生产计划明细集合
      */
     public List<BizProductionPlanDetail> getList(Map<String, Object> data);
+    public List<BizProductionPlanDetail> selectNotComplatedList(BizProductionPlanDetail bizProductionPlanDetail);
 
     /**
      * 物理删除

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

@@ -21,6 +21,7 @@ public interface IBizProductionPlanDetailService extends IService<BizProductionP
      * @return 生产计划明细集合
      */
     List<BizProductionPlanDetail> getList(Map<String, Object> data);
+    List<BizProductionPlanDetail> selectNotComplatedList(BizProductionPlanDetail bizProductionPlanDetail);
 
     /**
      * 物理删除

+ 6 - 0
src/main/java/cn/ezhizao/project/business/product/service/impl/BizProductionPlanDetailServiceImpl.java

@@ -33,6 +33,12 @@ public class BizProductionPlanDetailServiceImpl  extends ServiceImpl<BizProducti
     {
         return bizProductionPlanDetailMapper.getList(data);
     }
+
+    @Override
+    public List<BizProductionPlanDetail> selectNotComplatedList(BizProductionPlanDetail bizProductionPlanDetail) {
+        return bizProductionPlanDetailMapper.selectNotComplatedList(bizProductionPlanDetail);
+    }
+
     /**
      * 根据生产计划明细查询生产计划明细
      * @param bizProductionPlanDetail 生产计划明细

+ 12 - 1
src/main/resources/mybatis/business/product/BizProductionPlanDetailMapper.xml

@@ -22,7 +22,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getDayWorkSubPlanDetailID" resultMap="BizDayWorkResult">
         select * from biz_daywork where deleted = 0 and production_plan_detail_id = #{id}
     </select>
-
+    <select id="selectNotComplatedList" resultMap="BizProductionPlanDetailResult">
+        SELECT *
+        FROM biz_production_plan_detail
+        WHERE id IN
+        <foreach collection="planDetailIds" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+            AND deleted = 0
+            <if test="keywords != null and keywords != ''">
+                AND (product_description LIKE CONCAT('%', #{keywords}, '%') OR production_plan_no LIKE CONCAT('%', #{keywords}, '%'))
+            </if>
+    </select>
     <select id="getList" resultMap="BizProductionPlanDetailResult">
         SELECT * FROM biz_production_plan_detail
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">