|
|
|
@ -13,13 +13,8 @@ import org.jeecg.modules.productplan.entity.ZyPlanProcessAccessories; |
|
|
|
|
import org.jeecg.modules.productplan.entity.ZyPlanProcessFabric; |
|
|
|
|
import org.jeecg.modules.productplan.entity.ZyProductPlan; |
|
|
|
|
import org.jeecg.modules.productplan.enums.ProductPlanStatusEnum; |
|
|
|
|
import org.jeecg.modules.productplan.mapper.ZyPlanProcessAccessoriesMapper; |
|
|
|
|
import org.jeecg.modules.productplan.mapper.ZyPlanProcessFabricMapper; |
|
|
|
|
import org.jeecg.modules.productplan.mapper.ZyProductPlanMapper; |
|
|
|
|
import org.jeecg.modules.productplan.service.*; |
|
|
|
|
import org.jeecg.modules.productprocessaccessories.service.IProductProcessAccessoriesService; |
|
|
|
|
import org.jeecg.modules.productprocessfabric.entity.ProductProcessFabric; |
|
|
|
|
import org.jeecg.modules.productprocessfabric.service.IProductProcessFabricService; |
|
|
|
|
import org.jeecg.modules.system.entity.SysDepart; |
|
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
|
import org.jeecg.modules.system.service.ISysDepartService; |
|
|
|
@ -36,8 +31,6 @@ import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.atomic.AtomicBoolean; |
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
@ -259,7 +252,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(rollbackFor = Exception.class, readOnly = false) |
|
|
|
|
public void doAuto(List<String> workOrderList4Mock) { |
|
|
|
|
public List<Map<String, List<ZyPlanProcess>>> doAuto(List<String> workOrderList4Mock) { |
|
|
|
|
|
|
|
|
|
//1,获取未排产工单
|
|
|
|
|
List<WorkOrder> workOrderList; |
|
|
|
@ -274,12 +267,12 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp |
|
|
|
|
|
|
|
|
|
// List<WorkOrder> workOrderList = iWorkOrderService.list(new LambdaQueryWrapper<WorkOrder>()
|
|
|
|
|
// .eq(WorkOrder::getWorkOrderStatus, WorkOrderStatusEnum.UNAUDITED.getCode()));
|
|
|
|
|
if (ObjectUtils.isEmpty(workOrderList)) return; |
|
|
|
|
if (ObjectUtils.isEmpty(workOrderList)) return Collections.EMPTY_LIST; |
|
|
|
|
|
|
|
|
|
//2,保存生产计划
|
|
|
|
|
// List<ZyProductPlan> productPlanList = this.saveProductPlan(workOrderList);
|
|
|
|
|
List<ZyProductPlan> productPlanList = this.saveProductPlan4Mock(workOrderList); |
|
|
|
|
if (ObjectUtils.isEmpty(productPlanList)) return; |
|
|
|
|
if (ObjectUtils.isEmpty(productPlanList)) return Collections.EMPTY_LIST; |
|
|
|
|
|
|
|
|
|
//3,同步计划生产工序、同步生产计划工序面料、同步生产计划辅料
|
|
|
|
|
productPlanList.stream().forEach(f -> { |
|
|
|
@ -291,6 +284,7 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp |
|
|
|
|
//4,自动排位(匹配工序设备、工序工具、工人)
|
|
|
|
|
// 匹配工序设备、工序工具有一个工序失败,则工单作为异常处理,删除生产计划及相关子表
|
|
|
|
|
//只有一个生产计划的设备、工具都匹配成功才进行一下操作(生成物料单、发送到仓库)
|
|
|
|
|
List<Map<String, List<ZyPlanProcess>>> returnList = new LinkedList<>(); |
|
|
|
|
productPlanList.stream().forEach(k -> { |
|
|
|
|
//TODO 数据不完整,测试时注释
|
|
|
|
|
// boolean b = this.filling4Auto(k.getId());
|
|
|
|
@ -304,14 +298,19 @@ public class IZyProductPlanAutoServiceImpl extends ServiceImpl<ZyProductPlanMapp |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
Map<String, List<ZyPlanProcess>> map = new HashMap<>(); |
|
|
|
|
map.put(k.getProductCode(), planProcessList); |
|
|
|
|
//测试需要返回生产计划工序
|
|
|
|
|
returnList.add(map); |
|
|
|
|
}); |
|
|
|
|
return returnList; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 匹配设备&工具&工人 |
|
|
|
|
* <p> |
|
|
|
|
* 匹配车间工位设备与工序设备,工位设备包含工序设备即匹配成功,匹配失败做异常处理 |
|
|
|
|
* 匹配车间工位工具与工序设备,工位设备包含工序设备即匹配成功,匹配失败做异常处理 |
|
|
|
|
* 匹配车间工位工具与工序工具,工位设备包含工序设备即匹配成功,匹配失败做异常处理 |
|
|
|
|
* |
|
|
|
|
* @param planId |
|
|
|
|
*/ |
|
|
|
|