|
@@ -2345,6 +2345,22 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
|
|
|
order.setOrderNumber(createWorkOrderNumber());
|
|
order.setOrderNumber(createWorkOrderNumber());
|
|
|
order.setType(2);
|
|
order.setType(2);
|
|
|
order.setResult(2);
|
|
order.setResult(2);
|
|
|
|
|
+ // 如果前端没有获取到部门信息 deptId 则使用设备所属部门 作为工单的deptId
|
|
|
|
|
+ if (ObjUtil.isEmpty(order.getDeptId())) {
|
|
|
|
|
+ List<Long> deviceIds = new ArrayList<>();
|
|
|
|
|
+ // 查询 mainWorkOrderBom 集合内部各设备所在部门deptId
|
|
|
|
|
+ workOrderBOMs.forEach(bom -> {
|
|
|
|
|
+ deviceIds.add(bom.getDeviceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ IotDevicePageReqVO reqVO = new IotDevicePageReqVO();
|
|
|
|
|
+ reqVO.setDeviceIds(deviceIds);
|
|
|
|
|
+ List<IotDeviceDO> devices = iotDeviceMapper.selectListAlone(reqVO);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(devices)) {
|
|
|
|
|
+ devices.forEach(device -> {
|
|
|
|
|
+ order.setDeptId(device.getDeptId());
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
iotMainWorkOrderMapper.insert(order);
|
|
iotMainWorkOrderMapper.insert(order);
|
|
|
// 保养工单明细
|
|
// 保养工单明细
|
|
|
Set<Long> bomNodeIds = new HashSet<>();
|
|
Set<Long> bomNodeIds = new HashSet<>();
|