|
@@ -420,6 +420,16 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
e.setStatus(DeviceDeliveryStatusEnum.DELIVER);
|
|
e.setStatus(DeviceDeliveryStatusEnum.DELIVER);
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
this.updateBatchById(tbDeviceDeliveryList);
|
|
this.updateBatchById(tbDeviceDeliveryList);
|
|
|
|
+
|
|
|
|
+ //更新设备的状态为出库
|
|
|
|
+ tbDeviceDeliveryList.forEach(e -> {
|
|
|
|
+ SysDevice device = sysDeviceService.getOne(
|
|
|
|
+ new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, e.getSerialNo()));
|
|
|
|
+ if(Objects.nonNull(device)) {
|
|
|
|
+ device.setBound(InOutTypeEnum.OUT);
|
|
|
|
+ sysDeviceService.updateById(device);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
break;
|
|
break;
|
|
case RECEIVE:
|
|
case RECEIVE:
|
|
// 变更为已签收状态(设备发货列表点击签收触发||sop现场测试签收 -> DELIVER -> RECEIVE)
|
|
// 变更为已签收状态(设备发货列表点击签收触发||sop现场测试签收 -> DELIVER -> RECEIVE)
|
|
@@ -431,6 +441,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
String.format("只有[出入库过程中]且[%s]的发货记录才能[%s]", DeviceDeliveryStatusEnum.DELIVER.getTitle(),
|
|
String.format("只有[出入库过程中]且[%s]的发货记录才能[%s]", DeviceDeliveryStatusEnum.DELIVER.getTitle(),
|
|
"签收"));
|
|
"签收"));
|
|
}
|
|
}
|
|
|
|
+
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
Long currenTime = System.currentTimeMillis();
|
|
Long currenTime = System.currentTimeMillis();
|
|
e.setReceiveUserId(requestUserId);
|
|
e.setReceiveUserId(requestUserId);
|
|
@@ -440,18 +451,30 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
e.setStatus(DeviceDeliveryStatusEnum.RECEIVE);
|
|
e.setStatus(DeviceDeliveryStatusEnum.RECEIVE);
|
|
if (InOutTypeEnum.IN.equals(e.getDeliveryType())) {
|
|
if (InOutTypeEnum.IN.equals(e.getDeliveryType())) {
|
|
e.setEffect(false);
|
|
e.setEffect(false);
|
|
- } else {
|
|
|
|
|
|
+ needAutoReceiveIdList.add(e.getId());
|
|
|
|
+ }
|
|
|
|
+ /*else {
|
|
// 出库签收自动生成出入库登记出库记录
|
|
// 出库签收自动生成出入库登记出库记录
|
|
- if (DeviceUsageTypeEnum.PROJECT.equals(e.getUsageType())) {
|
|
|
|
|
|
+ if (DeviceUsageTypeEnum.PROJECT.equals(e.getUsageType())) {
|
|
throw ExceptionResultEnum.ERROR.exception("项目用途的设备不能手动签收(sop现场环境测试签收)");
|
|
throw ExceptionResultEnum.ERROR.exception("项目用途的设备不能手动签收(sop现场环境测试签收)");
|
|
}
|
|
}
|
|
needAutoReceiveIdList.add(e.getId());
|
|
needAutoReceiveIdList.add(e.getId());
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
|
|
+ this.updateBatchById(tbDeviceDeliveryList);
|
|
|
|
+ //更新设备的状态为入库
|
|
|
|
+ tbDeviceDeliveryList.forEach(e -> {
|
|
|
|
+ SysDevice device = sysDeviceService.getOne(
|
|
|
|
+ new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, e.getSerialNo()));
|
|
|
|
+ if(Objects.nonNull(device)) {
|
|
|
|
+ device.setBound(InOutTypeEnum.IN);
|
|
|
|
+ sysDeviceService.updateById(device);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
if (CollectionUtils.isNotEmpty(needAutoReceiveIdList)) {
|
|
if (CollectionUtils.isNotEmpty(needAutoReceiveIdList)) {
|
|
- this.autoOutDeviceForTrain(needAutoReceiveIdList);
|
|
|
|
|
|
+ this.autoOutDeviceForTrain(needAutoReceiveIdList, InOutTypeEnum.IN);
|
|
}
|
|
}
|
|
- this.updateBatchById(tbDeviceDeliveryList);
|
|
|
|
break;
|
|
break;
|
|
case CANCEL:
|
|
case CANCEL:
|
|
// 变更为已作废状态(只有带发货状态能被作废)
|
|
// 变更为已作废状态(只有带发货状态能被作废)
|
|
@@ -591,19 +614,19 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
- public void autoOutDeviceForTrain(List<Long> deviceDeliveryIdList) {
|
|
|
|
|
|
+ public void autoOutDeviceForTrain(List<Long> deviceDeliveryIdList, InOutTypeEnum inOutType) {
|
|
List<TBDeviceDelivery> tbDeviceDeliveryList = this.listByIds(deviceDeliveryIdList);
|
|
List<TBDeviceDelivery> tbDeviceDeliveryList = this.listByIds(deviceDeliveryIdList);
|
|
if (CollectionUtils.isNotEmpty(tbDeviceDeliveryList)) {
|
|
if (CollectionUtils.isNotEmpty(tbDeviceDeliveryList)) {
|
|
|
|
|
|
List<DeviceInOutForm> deviceInOutFormList = new ArrayList<>();
|
|
List<DeviceInOutForm> deviceInOutFormList = new ArrayList<>();
|
|
for (TBDeviceDelivery tbDeviceDelivery : tbDeviceDeliveryList) {
|
|
for (TBDeviceDelivery tbDeviceDelivery : tbDeviceDeliveryList) {
|
|
String serialNo = tbDeviceDelivery.getSerialNo();
|
|
String serialNo = tbDeviceDelivery.getSerialNo();
|
|
- if (!tbDeviceDelivery.getEffect()) {
|
|
|
|
|
|
+ /*if (!tbDeviceDelivery.getEffect()) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的记录是已完成的数据,不能操作", serialNo));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的记录是已完成的数据,不能操作", serialNo));
|
|
- }
|
|
|
|
- TBDeviceInOut tbDeviceInOut = tbDeviceInOutService.getOne(
|
|
|
|
|
|
+ }*/
|
|
|
|
+ /* TBDeviceInOut tbDeviceInOut = tbDeviceInOutService.getOne(
|
|
new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo)
|
|
new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getDeviceSerialNo, serialNo)
|
|
- .orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));
|
|
|
|
|
|
+ .orderByDesc(TBDeviceInOut::getSerialNo).last(SystemConstant.LIMIT1));*/
|
|
|
|
|
|
SysDevice sysDevice = sysDeviceService.getOne(
|
|
SysDevice sysDevice = sysDeviceService.getOne(
|
|
new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo)
|
|
new QueryWrapper<SysDevice>().lambda().eq(SysDevice::getSerialNo, serialNo)
|
|
@@ -611,7 +634,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
if (Objects.isNull(sysDevice)) {
|
|
if (Objects.isNull(sysDevice)) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备在设备配置表中不存在", serialNo));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备在设备配置表中不存在", serialNo));
|
|
}
|
|
}
|
|
- InOutTypeEnum sysType = sysDevice.getBound();
|
|
|
|
|
|
+ /*InOutTypeEnum sysType = sysDevice.getBound();
|
|
if (Objects.nonNull(tbDeviceInOut)) {
|
|
if (Objects.nonNull(tbDeviceInOut)) {
|
|
InOutTypeEnum inOutType = tbDeviceInOut.getType();
|
|
InOutTypeEnum inOutType = tbDeviceInOut.getType();
|
|
if (!sysType.equals(inOutType)) {
|
|
if (!sysType.equals(inOutType)) {
|
|
@@ -622,7 +645,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
if (InOutTypeEnum.OUT.equals(sysType)) {
|
|
if (InOutTypeEnum.OUT.equals(sysType)) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备为出库状态,状态异常", serialNo));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("所选设备序列号为[%s]的设备为出库状态,状态异常", serialNo));
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
DeviceInOutForm deviceInOutForm = new DeviceInOutForm();
|
|
DeviceInOutForm deviceInOutForm = new DeviceInOutForm();
|
|
deviceInOutForm.setSerialNo(serialNo);
|
|
deviceInOutForm.setSerialNo(serialNo);
|
|
@@ -643,11 +666,12 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
deviceInOutForm.setLocation(sysDevice.getLocation());
|
|
deviceInOutForm.setLocation(sysDevice.getLocation());
|
|
deviceInOutForm.setAddress(tbDeviceDelivery.getMailingAddress());
|
|
deviceInOutForm.setAddress(tbDeviceDelivery.getMailingAddress());
|
|
deviceInOutForm.setExpressNo(tbDeviceDelivery.getExpressNo());
|
|
deviceInOutForm.setExpressNo(tbDeviceDelivery.getExpressNo());
|
|
|
|
+ deviceInOutForm.setCrmNo(tbDeviceDelivery.getCrmNo());
|
|
deviceInOutFormList.add(deviceInOutForm);
|
|
deviceInOutFormList.add(deviceInOutForm);
|
|
}
|
|
}
|
|
DeviceInOutSubmitParam deviceInOutSubmitParam = new DeviceInOutSubmitParam();
|
|
DeviceInOutSubmitParam deviceInOutSubmitParam = new DeviceInOutSubmitParam();
|
|
deviceInOutSubmitParam.setInOutTime(System.currentTimeMillis());
|
|
deviceInOutSubmitParam.setInOutTime(System.currentTimeMillis());
|
|
- deviceInOutSubmitParam.setInOutType(InOutTypeEnum.OUT);
|
|
|
|
|
|
+ deviceInOutSubmitParam.setInOutType(inOutType);
|
|
deviceInOutSubmitParam.setPushSupplier(true);
|
|
deviceInOutSubmitParam.setPushSupplier(true);
|
|
deviceInOutSubmitParam.setDeviceInOutFormList(deviceInOutFormList);
|
|
deviceInOutSubmitParam.setDeviceInOutFormList(deviceInOutFormList);
|
|
tbDeviceInOutService.deviceInOutSubmit(deviceInOutSubmitParam);
|
|
tbDeviceInOutService.deviceInOutSubmit(deviceInOutSubmitParam);
|
|
@@ -764,6 +788,8 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
.set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.USING).set(TBDeviceDelivery::getReceiveUserId, userId)
|
|
.set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.USING).set(TBDeviceDelivery::getReceiveUserId, userId)
|
|
.set(TBDeviceDelivery::getReceiveTime, now).set(TBDeviceDelivery::getUpdateId, userId)
|
|
.set(TBDeviceDelivery::getReceiveTime, now).set(TBDeviceDelivery::getUpdateId, userId)
|
|
.set(TBDeviceDelivery::getUpdateTime, now));
|
|
.set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+ //写入设备出入库登记(出库)
|
|
|
|
+ autoOutDeviceForTrain(Collections.singletonList(id), InOutTypeEnum.OUT);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -792,6 +818,10 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
.set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.DELIVER).set(TBDeviceDelivery::getReceiveUserId, null)
|
|
.set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.DELIVER).set(TBDeviceDelivery::getReceiveUserId, null)
|
|
.set(TBDeviceDelivery::getReceiveTime, null).set(TBDeviceDelivery::getUpdateId, userId)
|
|
.set(TBDeviceDelivery::getReceiveTime, null).set(TBDeviceDelivery::getUpdateId, userId)
|
|
.set(TBDeviceDelivery::getUpdateTime, now));
|
|
.set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+
|
|
|
|
+ //删除设备出入库登记
|
|
|
|
+ tbDeviceInOutService.remove(new QueryWrapper<TBDeviceInOut>().lambda().eq(TBDeviceInOut::getCrmNo, deviceDelivery.getCrmNo())
|
|
|
|
+ .eq(TBDeviceInOut::getDeviceSerialNo, deviceDelivery.getSerialNo()).eq(TBDeviceInOut::getType, InOutTypeEnum.OUT));
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -801,9 +831,6 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
if (Objects.isNull(deviceDelivery)) {
|
|
if (Objects.isNull(deviceDelivery)) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("设备发货记录不存在,ID:[%s]", id));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("设备发货记录不存在,ID:[%s]", id));
|
|
}
|
|
}
|
|
-// if (deviceDelivery.getDeviceStatus().equals(deviceStatus)) {
|
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("未做改动");
|
|
|
|
-// }
|
|
|
|
//更新设备发货记录的设备状态
|
|
//更新设备发货记录的设备状态
|
|
this.update(new UpdateWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getId, id)
|
|
this.update(new UpdateWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getId, id)
|
|
.set(TBDeviceDelivery::getDeviceStatus, deviceStatus).set(TBDeviceDelivery::getUpdateId, userId)
|
|
.set(TBDeviceDelivery::getDeviceStatus, deviceStatus).set(TBDeviceDelivery::getUpdateId, userId)
|