|
@@ -11,10 +11,7 @@ import com.qmth.sop.business.bean.dto.DeviceInfoDto;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
import com.qmth.sop.business.bean.params.DeviceDeliveryParam;
|
|
import com.qmth.sop.business.bean.params.DeviceInOutForm;
|
|
import com.qmth.sop.business.bean.params.DeviceInOutForm;
|
|
import com.qmth.sop.business.bean.result.TBDeviceDeliveryResult;
|
|
import com.qmth.sop.business.bean.result.TBDeviceDeliveryResult;
|
|
-import com.qmth.sop.business.entity.SysDevice;
|
|
|
|
-import com.qmth.sop.business.entity.SysSupplier;
|
|
|
|
-import com.qmth.sop.business.entity.SysUser;
|
|
|
|
-import com.qmth.sop.business.entity.TBDeviceDelivery;
|
|
|
|
|
|
+import com.qmth.sop.business.entity.*;
|
|
import com.qmth.sop.business.mapper.TBDeviceDeliveryMapper;
|
|
import com.qmth.sop.business.mapper.TBDeviceDeliveryMapper;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.business.util.excel.BasicExcelListener;
|
|
import com.qmth.sop.business.util.excel.BasicExcelListener;
|
|
@@ -57,7 +54,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
@Resource
|
|
@Resource
|
|
private SysUserService sysUserService;
|
|
private SysUserService sysUserService;
|
|
@Resource
|
|
@Resource
|
|
- private BasicAttachmentService basicAttachmentService;
|
|
|
|
|
|
+ private TBCrmService tbCrmService;
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
@@ -76,6 +73,16 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
}).headRowNumber(2).sheet(0).doRead();
|
|
}).headRowNumber(2).sheet(0).doRead();
|
|
|
|
|
|
List<DeviceDeliveryImportDto> deviceDeliveryImportDtoList = deviceDeliveryImportDtoLinkedMultiValueMap.get(BasicExcelListener.SUCCESS);
|
|
List<DeviceDeliveryImportDto> deviceDeliveryImportDtoList = deviceDeliveryImportDtoLinkedMultiValueMap.get(BasicExcelListener.SUCCESS);
|
|
|
|
+
|
|
|
|
+ // 派单序列号集合
|
|
|
|
+ List<String> crmNoList = tbCrmService.list(new QueryWrapper<TBCrm>()
|
|
|
|
+ .lambda()
|
|
|
|
+ .eq(TBCrm::getEnable,true))
|
|
|
|
+ .stream()
|
|
|
|
+ .map(TBCrm::getCrmNo)
|
|
|
|
+ .distinct()
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+
|
|
if (CollectionUtils.isNotEmpty(deviceDeliveryImportDtoList)) {
|
|
if (CollectionUtils.isNotEmpty(deviceDeliveryImportDtoList)) {
|
|
List<SysSupplier> sysSupplierList = sysSupplierService.list(new QueryWrapper<SysSupplier>().lambda().eq(SysSupplier::getType, SupplierTypeEnum.DEVICE));
|
|
List<SysSupplier> sysSupplierList = sysSupplierService.list(new QueryWrapper<SysSupplier>().lambda().eq(SysSupplier::getType, SupplierTypeEnum.DEVICE));
|
|
// 供应商map
|
|
// 供应商map
|
|
@@ -135,6 +142,10 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
willAddSysDevice.setBound(InOutTypeEnum.IN);
|
|
willAddSysDevice.setBound(InOutTypeEnum.IN);
|
|
willAddSysDevice.setEnable(true);
|
|
willAddSysDevice.setEnable(true);
|
|
sysDeviceService.save(willAddSysDevice);
|
|
sysDeviceService.save(willAddSysDevice);
|
|
|
|
+ } else {
|
|
|
|
+ if (InOutTypeEnum.OUT.equals(sysDevice.getBound())) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("序列号为[%s]的设备在设备管理中已存在且状态为'出库',不能导入", sysDevice.getSerialNo()));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 查询是否有处于发货过程中设备
|
|
// 查询是否有处于发货过程中设备
|
|
@@ -150,6 +161,10 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
|
|
|
TBDeviceDelivery tbDeviceDelivery = new TBDeviceDelivery();
|
|
TBDeviceDelivery tbDeviceDelivery = new TBDeviceDelivery();
|
|
if (crmNo != null && crmNo.length() > 0) {
|
|
if (crmNo != null && crmNo.length() > 0) {
|
|
|
|
+ if (crmNoList.contains(crmNo)){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("派单号不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
tbDeviceDelivery.setCrmNo(crmNo);
|
|
tbDeviceDelivery.setCrmNo(crmNo);
|
|
tbDeviceDelivery.setUsageType(DeviceUsageTypeEnum.PROJECT);
|
|
tbDeviceDelivery.setUsageType(DeviceUsageTypeEnum.PROJECT);
|
|
} else {
|
|
} else {
|
|
@@ -342,7 +357,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
case DELIVER:
|
|
case DELIVER:
|
|
// 变更为已发货状态(供应商点击批量发货时触发 UN_DELIVER -> DELIVER(或sop入库新增记录触发))
|
|
// 变更为已发货状态(供应商点击批量发货时触发 UN_DELIVER -> DELIVER(或sop入库新增记录触发))
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.UN_DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.UN_DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("只有[出入库过程中]且[%s]的记录才能[%s]", DeviceDeliveryStatusEnum.UN_DELIVER, "发货"));
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("只有[出入库过程中]且[%s]的记录才能[%s]", DeviceDeliveryStatusEnum.UN_DELIVER.getTitle(), "发货"));
|
|
}
|
|
}
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
Long currenTime = System.currentTimeMillis();
|
|
Long currenTime = System.currentTimeMillis();
|
|
@@ -358,7 +373,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
// 变更为已签收状态(设备发货列表点击签收触发||sop现场测试签收 -> DELIVER -> RECEIVE)
|
|
// 变更为已签收状态(设备发货列表点击签收触发||sop现场测试签收 -> DELIVER -> RECEIVE)
|
|
// 入库签收终止该入库记录的生命周期(出库签收不终止,设备发货出库生命周期的终止是在设备出库提交,生成设备发货入库记录时触发)
|
|
// 入库签收终止该入库记录的生命周期(出库签收不终止,设备发货出库生命周期的终止是在设备出库提交,生成设备发货入库记录时触发)
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("只有[出入库过程中]且[%s]的发货记录才能[%s]", DeviceDeliveryStatusEnum.DELIVER, "签收"));
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(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();
|
|
@@ -377,12 +392,13 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
// 变更为已作废状态(只有带发货状态能被作废)
|
|
// 变更为已作废状态(只有带发货状态能被作废)
|
|
// 作废触发时该出库生命周期终止
|
|
// 作废触发时该出库生命周期终止
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.UN_DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
if (tbDeviceDeliveryList.stream().anyMatch(e -> !DeviceDeliveryStatusEnum.UN_DELIVER.equals(e.getStatus()) || !e.getEffect())) {
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("只有[出入库过程中]且[%s]的发货记录才能[%s]", DeviceDeliveryStatusEnum.UN_DELIVER, "作废"));
|
|
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("只有[出入库过程中]且[%s]的发货记录才能[%s]", DeviceDeliveryStatusEnum.UN_DELIVER.getTitle(), "作废"));
|
|
}
|
|
}
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
tbDeviceDeliveryList = tbDeviceDeliveryList.stream().peek(e -> {
|
|
e.setUpdateId(requestUserId);
|
|
e.setUpdateId(requestUserId);
|
|
e.setUpdateTime(System.currentTimeMillis());
|
|
e.setUpdateTime(System.currentTimeMillis());
|
|
e.setStatus(DeviceDeliveryStatusEnum.CANCEL);
|
|
e.setStatus(DeviceDeliveryStatusEnum.CANCEL);
|
|
|
|
+ e.setEnable(false);
|
|
e.setEffect(false);
|
|
e.setEffect(false);
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
this.updateBatchById(tbDeviceDeliveryList);
|
|
this.updateBatchById(tbDeviceDeliveryList);
|
|
@@ -416,7 +432,7 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
|
|
|
|
String path = e.getExpressPhotoPath();
|
|
String path = e.getExpressPhotoPath();
|
|
if (path != null && path.length() > 0) {
|
|
if (path != null && path.length() > 0) {
|
|
- e.setExpressPhotoPath(basicAttachmentService.filePreviewPath(path));
|
|
|
|
|
|
+ e.setExpressPhotoPath(path);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|