guoyujia 6 kuukautta sitten
vanhempi
commit
38753a6e55

+ 14 - 1
src/main/java/cn/ezhizao/project/business/product/controller/BizDayworkItemController.java

@@ -1154,10 +1154,17 @@ public class BizDayworkItemController extends BaseController {
         List<BizDayworkCarrier> allCarries = bizDayworkCarrierService.query().eq("is_changed", 0).eq("process_inspection_id", 0L).in("carrier_id", dayworkCarriers.isEmpty() ? Collections.singletonList(0L) : dayworkCarriers.stream().map(BizDayworkCarrier::getCarrierId).collect(Collectors.toList())).list();
         // 关联批次的所有最后一条报工
         List<BizDayworkItem> bizDayworkItems = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).in("status", Arrays.asList("0", "1", "2", "3")).orderByDesc("status").orderByDesc("create_time").list();
+        List<BizDayworkItem> bizDayworkItemAll = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).orderByDesc("status").orderByDesc("create_time").list();
         List<BizDayworkItem> bizDayworkItemList = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
         List<BizDaywork> bizDayworks = bizDayworkService.query().in("id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
         for (BizDaywork v : bizDayworks) {
             BizDayworkItem lastItem = bizDayworkItems.stream().filter(l -> l.getDayworkId().equals(v.getId())).findFirst().orElse(null);
+            //不筛选status,当前批次最新一条报工
+            BizDayworkItem lastItemAll = bizDayworkItemAll.stream().filter(l -> l.getDayworkId().equals(v.getId())).findFirst().orElse(null);
+            //为了防止该工序已经周转到下一道序,且已经干了,所以判断如果当前processStepNumber和最新一条的步骤是否相同
+            if(lastItemAll != null && (!lastItemAll.getProcessStepNumber().equals(bizDayworkItem.getProcessStepNumber()) || (lastItemAll.getStatus().equals("4") || lastItemAll.getStatus().equals("5") || lastItemAll.getStatus().equals("7")))) {
+                return error( v.getLotCode()+"批次已周转,请勿重复操作");
+            }
             if (lastItem != null && lastItem.getStatus().equals("3")) {
                 List<BizDayworkItem> allItem = bizDayworkItemList.stream().filter(l -> l.getDayworkId().equals(v.getId()) && l.getTechnologicalProcessDetailId().equals(lastItem.getTechnologicalProcessDetailId())).collect(Collectors.toList());
                 Integer lot = allItem.stream().mapToInt(BizDayworkItem::getQualifiedNum).sum();
@@ -1239,7 +1246,7 @@ public class BizDayworkItemController extends BaseController {
         // 根据获取到的所有批次的id,查询出所有批次的报工信息,并且状态是【"0", "1", "2", "3"】,按状态值倒序、创建日期的倒序,对数据进行排序,得到的数据是还未周转的数据。
         // 后续会通过该集合,获取某批次的最后一条报工信息
         List<BizDayworkItem> bizDayworkItems = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).in("status", Arrays.asList("0", "1", "2", "3")).orderByDesc("status").orderByDesc("create_time").list();
-
+        List<BizDayworkItem> bizDayworkItemsAll = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).orderByDesc("status").orderByDesc("create_time").list();
         // 根据获取到的所有批次的id,查询出所有批次的报工信息,不需要判断状态
         List<BizDayworkItem> bizDayworkItemList = bizDayworkItemService.query().in("daywork_id", allCarries.isEmpty() ? Collections.singletonList(0L) : allCarries.stream().map(BizDayworkCarrier::getDayworkId).collect(Collectors.toList())).list();
         // 获取所有的 daywork 数据集合
@@ -1252,6 +1259,12 @@ public class BizDayworkItemController extends BaseController {
         for (BizDaywork v : bizDayworks) {
             // 获取该批次的最后一条报工
             BizDayworkItem lastItem = bizDayworkItems.stream().filter(l -> l.getDayworkId().equals(v.getId())).findFirst().orElse(null);
+            //批次所有报工,判断是否已经周转了,如果周转返回报错信息
+            BizDayworkItem lastItemAll = bizDayworkItemsAll.stream().filter(l -> l.getDayworkId().equals(v.getId())).findFirst().orElse(null);
+            //为了防止该工序已经周转到下一道序,且已经干了,所以判断如果当前processStepNumber和最新一条的步骤是否相同
+            if(lastItemAll != null && (!lastItemAll.getProcessStepNumber().equals(bizDayworkItem.getProcessStepNumber()) || (lastItemAll.getStatus().equals("4") || lastItemAll.getStatus().equals("5") || lastItemAll.getStatus().equals("7")))) {
+                return error( v.getLotCode()+"批次已周转,请勿重复操作");
+            }
             // 如果最后一条报工信息存在,并且报工状态为:3,则说明该报工已经工序完成
             if (lastItem != null && lastItem.getStatus().equals("3")) {
                 // 根据当前批次的id,获取该批次下的工序id与最后一条报工的工序id相同的所有报工信息

+ 3 - 3
src/main/java/cn/ezhizao/project/business/product/controller/BizProcessInspecionController.java

@@ -3355,9 +3355,9 @@ public class BizProcessInspecionController extends BaseController {
         if (latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("4") || latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("5") || latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("7")) {
             return error("当前批次已经周转");
         }
-        if (!latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("3")) {
-            return error("当前工序未完成,不能交检");
-        }
+//        if (!latestList.stream().map(BizDayworkItem::getStatus).collect(Collectors.toList()).contains("3")) {
+//            return error("当前工序未完成,不能交检");
+//        }
         List<BizDayworkItem> collect = latestList.stream().filter(v -> v.getStatus().equals("1") || v.getStatus().equals("2") || v.getStatus().equals("3")).collect(Collectors.toList());
         lot.setDayworkItemList(collect);
         lot.setDeptName(item.getDeptName());

+ 14 - 0
src/main/java/cn/ezhizao/project/system/controller/SysDeptController.java

@@ -71,6 +71,20 @@ public class SysDeptController extends BaseController
         }
         return success(departments);
     }
+    //周转工段选择
+    @GetMapping("/getDeptListInfo")
+    public AjaxResult getDeptListInfo(SysDept dept) throws NoSuchFieldException, IllegalAccessException {
+        //判断该批是否是废品回用
+        List<SysDept> departments = new ArrayList<>();
+        if(dept.getIsAmend() == 1 ||dept.getIsWasteRecycling() == 1) {
+            BizLot bizLot = bizLotService.query().eq("id", dept.getLotId()).list().get(0);
+            dept.setLotTechnologicalProcessId(bizLot.getTechnologicalProcessId());
+            departments = deptService.selectDeptListByTechnologyWasteRecyclingInfo(dept);
+        } else {
+            departments = deptService.selectDeptListByPlanDetailsInfo(dept);
+        }
+        return success(departments);
+    }
 
     @GetMapping("/getUserDeptList")
     public AjaxResult getUserDeptList(String userId) throws NoSuchFieldException, IllegalAccessException {

+ 4 - 0
src/main/java/cn/ezhizao/project/system/mapper/SysDeptMapper.java

@@ -27,7 +27,11 @@ public interface SysDeptMapper extends BaseMapper<SysDept> {
      */
     public List<SysDept> selectDeptListByPlanDetailsId(SysDept dept);
 
+    public List<SysDept> selectDeptListByPlanDetailsInfo(SysDept dept);
+
     public List<SysDept> selectDeptListByTechnologyWasteRecyclingId(SysDept dept);
+
+    public List<SysDept> selectDeptListByTechnologyWasteRecyclingInfo(SysDept dept);
     /**
      * 根据角色ID查询部门树信息
      *

+ 4 - 0
src/main/java/cn/ezhizao/project/system/service/ISysDeptService.java

@@ -27,12 +27,16 @@ public interface ISysDeptService
      */
     public List<SysDept> selectDeptListByPlanDetailsId(SysDept dept);
 
+    public List<SysDept> selectDeptListByPlanDetailsInfo(SysDept dept);
+
     /**
      *  查询部门管理ByTechnologyWasteRecyclingId
      * @param dept
      * @return
      */
     public List<SysDept> selectDeptListByTechnologyWasteRecyclingId(SysDept dept);
+
+    public List<SysDept> selectDeptListByTechnologyWasteRecyclingInfo(SysDept dept);
     /**
      * 查询部门树结构信息
      *

+ 8 - 0
src/main/java/cn/ezhizao/project/system/service/impl/SysDeptServiceImpl.java

@@ -53,10 +53,18 @@ public class SysDeptServiceImpl implements ISysDeptService
     public List<SysDept> selectDeptListByPlanDetailsId(SysDept dept) {
         return deptMapper.selectDeptListByPlanDetailsId(dept);
     }
+    @Override
+    public List<SysDept> selectDeptListByPlanDetailsInfo(SysDept dept) {
+        return deptMapper.selectDeptListByPlanDetailsInfo(dept);
+    }
+
     @Override
     public List<SysDept> selectDeptListByTechnologyWasteRecyclingId(SysDept dept) {
         return deptMapper.selectDeptListByTechnologyWasteRecyclingId(dept);
     }
+    public List<SysDept> selectDeptListByTechnologyWasteRecyclingInfo(SysDept dept) {
+        return deptMapper.selectDeptListByTechnologyWasteRecyclingInfo(dept);
+    }
 
     /**
      * 查询部门树结构信息

+ 20 - 0
src/main/resources/mybatis/system/SysDeptMapper.xml

@@ -176,6 +176,26 @@
 		FROM biz_lot_technological_process_detail btwrd
 		WHERE btwrd.lot_technological_process_id = #{lotTechnologicalProcessId}) AS m ON m.process_id = dp.process_id AND d.is_work_section = 1 AND d.tenant_id = #{tenantId}
 	</select>
+	<select id="selectDeptListByPlanDetailsInfo" resultType="cn.ezhizao.project.system.domain.SysDept">
+		SELECT DISTINCT dp.dept_id, d.dept_name, d.workshop_id,d.is_sort_packaging
+		FROM sys_dept d
+		INNER JOIN biz_dept_process dp ON d.dept_id = dp.dept_id
+		INNER JOIN
+		(SELECT DISTINCT btpd.process_id
+		FROM biz_technological_process_detail btpd
+		INNER JOIN biz_production_plan_detail bppd
+		ON bppd.technological_process_id = btpd.technological_process_id
+		WHERE bppd.id = #{productionPlanDetailId} and btpd.tenant_id !=9) AS m ON m.process_id = dp.process_id AND d.is_work_section = 1 AND d.tenant_id = #{tenantId} and d.del_flag = '0' and d.dept_code != '170000'
+	</select>
+	<select id="selectDeptListByTechnologyWasteRecyclingInfo" resultType="cn.ezhizao.project.system.domain.SysDept">
+		SELECT DISTINCT dp.dept_id, d.dept_name, d.workshop_id,d.is_sort_packaging
+		FROM sys_dept d
+		INNER JOIN biz_dept_process dp ON d.dept_id = dp.dept_id
+		INNER JOIN
+		(SELECT DISTINCT btwrd.process_id
+		FROM biz_lot_technological_process_detail btwrd
+		WHERE btwrd.lot_technological_process_id = #{lotTechnologicalProcessId}) AS m ON m.process_id = dp.process_id AND d.is_work_section = 1 AND d.tenant_id = #{tenantId} and d.del_flag = '0' and d.dept_code != '170000'
+	</select>
 
 
 	<insert id="insertDept" parameterType="SysDept">