|
|
|
@ -25,6 +25,8 @@ import org.jeecg.modules.demo.pro.service.IZyProcessFabricService; |
|
|
|
|
import org.jeecg.modules.demo.pro.service.IZyProcessMachineService; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.entity.ZyOrders; |
|
|
|
|
import org.jeecg.modules.demo.zyorders.service.IZyOrdersService; |
|
|
|
|
import org.jeecg.modules.device.entity.ZyDevice; |
|
|
|
|
import org.jeecg.modules.device.service.IZyDeviceService; |
|
|
|
|
import org.jeecg.modules.product.zyproductprocess.entity.ZyProductProcess; |
|
|
|
|
import org.jeecg.modules.product.zyproductprocess.service.IZyProductProcessService; |
|
|
|
|
import org.jeecg.modules.productplan.entity.*; |
|
|
|
@ -128,7 +130,7 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
|
private IZyPlanProcessAccessoriesService iZyPlanProcessAccessoriesService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IZyProcessFabricService iZyProcessFabricService; |
|
|
|
|
private IZyDeviceService iZyDeviceService; |
|
|
|
|
@Autowired |
|
|
|
|
private IZyProcessAccessoriesService iZyProcessAccessoriesService; |
|
|
|
|
|
|
|
|
@ -248,8 +250,9 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
|
* 根据工序,查询工序设备表zy_process_machine, |
|
|
|
|
*/ |
|
|
|
|
Optional.ofNullable(planProcessList).orElse(new ArrayList<>()).forEach(e -> { |
|
|
|
|
List<ZyProcessMachine> machineList = iZyProcessMachineService.list(new LambdaQueryWrapper<ZyProcessMachine>().eq(ZyProcessMachine::getProcessId, e.getProcessId())); |
|
|
|
|
this.diffMachine(e, stationList, machineList); |
|
|
|
|
//工序设备列表
|
|
|
|
|
List<ZyProcessMachine> zyProcessMachineList = iZyProcessMachineService.list(new LambdaQueryWrapper<ZyProcessMachine>().eq(ZyProcessMachine::getProcessId, e.getProcessId())); |
|
|
|
|
this.diffMachine(e, stationList, zyProcessMachineList); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -298,16 +301,29 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void diffMachine(ZyPlanProcess zyPlanProcess, List<Station> stationList, List<ZyProcessMachine> machineList) { |
|
|
|
|
if (!ObjectUtils.isEmpty(machineList)) { |
|
|
|
|
List<String> machineList1 = machineList.stream().map(ZyProcessMachine::getMachineId).collect(Collectors.toList()); |
|
|
|
|
/** |
|
|
|
|
* @param zyPlanProcess 生产计划工序 |
|
|
|
|
* @param stationList 车间工位 |
|
|
|
|
* @param zyProcessMachineList 工序设备列表 |
|
|
|
|
*/ |
|
|
|
|
void diffMachine(ZyPlanProcess zyPlanProcess, List<Station> stationList, List<ZyProcessMachine> zyProcessMachineList) { |
|
|
|
|
if (!ObjectUtils.isEmpty(zyProcessMachineList)) { |
|
|
|
|
//工序设备类型列表
|
|
|
|
|
List<String> zyDevicetype_codes = zyProcessMachineList.stream().map(ZyProcessMachine::getCode).collect(Collectors.toList()); |
|
|
|
|
Optional.ofNullable(stationList).orElse(new ArrayList<>()).forEach(e -> { |
|
|
|
|
List<StationMachine> stationMachineList = iStationMachineService.list(new LambdaQueryWrapper<StationMachine>().eq(StationMachine::getStationId, e.getId())); |
|
|
|
|
List<String> machineList2 = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList()); |
|
|
|
|
if (machineList2.containsAll(machineList1)) { |
|
|
|
|
String collect = machineList1.stream().collect(Collectors.joining(",")); |
|
|
|
|
//工位设备ids
|
|
|
|
|
List<String> stationMachineIds = Optional.ofNullable(stationMachineList).orElse(new ArrayList<>()).stream().map(StationMachine::getMachineId).collect(Collectors.toList()); |
|
|
|
|
List<ZyDevice> zyDeviceList = iZyDeviceService.list(new LambdaQueryWrapper<ZyDevice>().in(ZyDevice::getId, stationMachineIds)); |
|
|
|
|
List<String> zyDevice_typeCodes = Optional.ofNullable(zyDeviceList).orElse(new ArrayList<>()).stream().map(ZyDevice::getTypeCode).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 工位设备包含工序设备即匹配成功 |
|
|
|
|
*/ |
|
|
|
|
if (zyDevice_typeCodes.containsAll(zyDevicetype_codes)) { |
|
|
|
|
String collect = zyProcessMachineList.stream().map(ZyProcessMachine::getMachineId).collect(Collectors.joining(",")); |
|
|
|
|
zyPlanProcess.setMachineIds(collect); |
|
|
|
|
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(machineList1)); |
|
|
|
|
zyPlanProcess.setMachineNames(iStationMachineService.convertByMachineIds(stationMachineIds)); |
|
|
|
|
zyPlanProcess.setStationId(e.getId()); |
|
|
|
|
zyPlanProcess.setStationName(e.getStationName()); |
|
|
|
|
zyPlanProcess.setStationNum(e.getStationNum()); |
|
|
|
@ -373,15 +389,13 @@ public class ZyPlanProcessServiceImpl extends ServiceImpl<ZyPlanProcessMapper, Z |
|
|
|
|
//第一个没有前导工序
|
|
|
|
|
if (i == 0) { |
|
|
|
|
//判断是否有下到工序
|
|
|
|
|
if(planProcessList.size()>1) |
|
|
|
|
{ |
|
|
|
|
if (planProcessList.size() > 1) { |
|
|
|
|
ZyPlanProcess process1 = planProcessList.get(i); |
|
|
|
|
ZyPlanProcess process2 = planProcessList.get(i + 1); |
|
|
|
|
process1.setPostProcess(process2.getProcessId()); |
|
|
|
|
process1.setPostProcessName(process2.getProcessName()); |
|
|
|
|
updateList.add(process1); |
|
|
|
|
}else |
|
|
|
|
{ |
|
|
|
|
} else { |
|
|
|
|
ZyPlanProcess process1 = planProcessList.get(i); |
|
|
|
|
updateList.add(process1); |
|
|
|
|
} |
|
|
|
|