|
@@ -126,7 +126,7 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
|
|
|
@Transactional
|
|
|
public void transfer(TransferFormParam param) {
|
|
|
if (CollectionUtils.isEmpty(param.getSn()) && !CollectionUtils.isEmpty(param.getBatchNum())) {
|
|
|
- List<AppDevice> deviceList = appDeviceService.findAll(QueryParamExp.in("batchNum", param.getBatchNum().toArray(new String[]{})));
|
|
|
+ List<AppDevice> deviceList = appDeviceService.findAll(QueryParamExp.in("operateID", param.getBatchNum().toArray(new Integer[]{})));
|
|
|
param.setSn(new ArrayList<>());
|
|
|
deviceList.forEach(p -> param.getSn().add(p.getSn()));
|
|
|
}
|
|
@@ -143,41 +143,38 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
|
|
|
Date time = new Date();
|
|
|
|
|
|
BigInteger finalOperateID = operateID;
|
|
|
- AtomicBoolean allowTransfer = new AtomicBoolean(true);
|
|
|
//批量调拨时,若有不符合调拨条件的电池,则停止本次批量调拨
|
|
|
|
|
|
param.getSn().forEach(p -> {
|
|
|
AppDevice appDevice = appDeviceService.getOne(QueryParamExp.eq("sn", p));
|
|
|
if (null == appDevice) {
|
|
|
- allowTransfer.set(false);
|
|
|
- throw new ApiRuntimeException(p + "设备信息不存在!");
|
|
|
+ new ApiRuntimeException(p + "设备信息不存在!");
|
|
|
}
|
|
|
if (1 != appDevice.getStatus() && 2 != appDevice.getStatus()) {
|
|
|
- allowTransfer.set(false);
|
|
|
- throw new ApiRuntimeException(p + "不是入库状态,不能调拨!");
|
|
|
+ new ApiRuntimeException(p + "不是入库状态,不能调拨!");
|
|
|
}
|
|
|
if (1 != appDevice.getCheckStatus()) {
|
|
|
- allowTransfer.set(false);
|
|
|
- throw new ApiRuntimeException(p + "自检未通过,不能调拨!");
|
|
|
+ new ApiRuntimeException(p + "自检未通过,不能调拨!");
|
|
|
}
|
|
|
});
|
|
|
param.getSn().forEach(p -> {
|
|
|
String batchNum;
|
|
|
AppDevice appDevice = appDeviceService.getOne(QueryParamExp.eq("sn", p));
|
|
|
batchNum = appDevice.getBatchNum();
|
|
|
- if (2 == appDevice.getStatus()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- appDevice.setStatus(2); // 已划拨
|
|
|
- appDevice.setTransferTime(time);
|
|
|
- appDevice.setOwnerId(param.getCustomId()); // 设置归属
|
|
|
- appDevice.setTfDescribe(param.getDescribe());
|
|
|
- appDevice.setTfUsed(param.getUsed());
|
|
|
- appDeviceService.save(appDevice);
|
|
|
+ // 将可调拨的电池进行调拨
|
|
|
+ if (1 == appDevice.getStatus() && 1 == appDevice.getCheckStatus()) {
|
|
|
+
|
|
|
+ appDevice.setStatus(2); // 已划拨
|
|
|
+ appDevice.setTransferTime(time);
|
|
|
+ appDevice.setOwnerId(param.getCustomId()); // 设置归属
|
|
|
+ appDevice.setTfDescribe(param.getDescribe());
|
|
|
+ appDevice.setTfUsed(param.getUsed());
|
|
|
+ appDeviceService.save(appDevice);
|
|
|
|
|
|
- AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).toTransfer(param, time, batchNum, finalOperateID);
|
|
|
- appDeviceLog.setOperator(utilService.getUserName());
|
|
|
- save(appDeviceLog); // 记录划拨日志
|
|
|
+ AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).toTransfer(param, time, batchNum, finalOperateID);
|
|
|
+ appDeviceLog.setOperator(utilService.getUserName());
|
|
|
+ save(appDeviceLog); // 记录划拨日志
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -214,7 +211,7 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
|
|
|
@Transactional
|
|
|
public void outStorage(LibraryOutFormParam param) {
|
|
|
if (CollectionUtils.isEmpty(param.getSn()) && !CollectionUtils.isEmpty(param.getBatchNum())) {
|
|
|
- List<AppDevice> deviceList = appDeviceService.findAll(QueryParamExp.in("batchNum", param.getBatchNum().toArray(new String[]{})));
|
|
|
+ List<AppDevice> deviceList = appDeviceService.findAll(QueryParamExp.in("operateID", param.getBatchNum().toArray(new Integer[]{})));
|
|
|
param.setSn(new ArrayList<>());
|
|
|
deviceList.forEach(p -> param.getSn().add(p.getSn()));
|
|
|
}
|
|
@@ -231,32 +228,31 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
|
|
|
Date time = new Date();
|
|
|
|
|
|
//批量出库时,若有不符合出库条件的电池,则停止本次批量出库
|
|
|
- AtomicBoolean allowTransfer = new AtomicBoolean(true);
|
|
|
param.getSn().forEach(p -> {
|
|
|
AppDevice appDevice = appDeviceService.getOne(QueryParamExp.eq("sn", p));
|
|
|
if (null == appDevice) {
|
|
|
- allowTransfer.set(false);
|
|
|
- throw new ApiRuntimeException(p + "设备信息不存在!");
|
|
|
+ new ApiRuntimeException(p + "设备信息不存在!");
|
|
|
}
|
|
|
if ( 2 != appDevice.getStatus() && 3 != appDevice.getStatus()) {
|
|
|
- allowTransfer.set(false);
|
|
|
- throw new ApiRuntimeException(p + "不是调拨状态,不能出库!");
|
|
|
+ new ApiRuntimeException(p + "不是调拨状态,不能出库!");
|
|
|
}
|
|
|
});
|
|
|
BigInteger finalOperateID = operateID;
|
|
|
param.getSn().forEach(p -> {
|
|
|
String batchNum;
|
|
|
AppDevice appDevice = appDeviceService.getOne(QueryParamExp.eq("sn", p));
|
|
|
- if (3 == appDevice.getStatus()) {
|
|
|
- return;
|
|
|
+
|
|
|
+ // 将可出库的电池出库
|
|
|
+ if (2 == appDevice.getStatus()) {
|
|
|
+
|
|
|
+ batchNum = appDevice.getBatchNum();
|
|
|
+ appDevice.setOutstorageTime(time);
|
|
|
+ appDevice.setStatus(3); // 已出库
|
|
|
+ appDeviceService.save(appDevice);
|
|
|
+ AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).outStorage(param, time, batchNum, finalOperateID);
|
|
|
+ appDeviceLog.setOperator(utilService.getUserName());
|
|
|
+ save(appDeviceLog); // 记录出库日志
|
|
|
}
|
|
|
- batchNum = appDevice.getBatchNum();
|
|
|
- appDevice.setOutstorageTime(time);
|
|
|
- appDevice.setStatus(3); // 已出库
|
|
|
- appDeviceService.save(appDevice);
|
|
|
- AppDeviceLog appDeviceLog = new AppDeviceLog(p, appDevice.getImei()).outStorage(param, time, batchNum, finalOperateID);
|
|
|
- appDeviceLog.setOperator(utilService.getUserName());
|
|
|
- save(appDeviceLog); // 记录出库日志
|
|
|
});
|
|
|
}
|
|
|
}
|