|
@@ -13,6 +13,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.params.DeviceInOutSubmitParam;
|
|
import com.qmth.sop.business.bean.params.DeviceInOutSubmitParam;
|
|
|
|
+import com.qmth.sop.business.bean.result.DeviceSignResult;
|
|
import com.qmth.sop.business.bean.result.FlowFormWidgetResult;
|
|
import com.qmth.sop.business.bean.result.FlowFormWidgetResult;
|
|
import com.qmth.sop.business.bean.result.FlowTaskResult;
|
|
import com.qmth.sop.business.bean.result.FlowTaskResult;
|
|
import com.qmth.sop.business.bean.result.TBDeviceDeliveryResult;
|
|
import com.qmth.sop.business.bean.result.TBDeviceDeliveryResult;
|
|
@@ -26,6 +27,7 @@ import com.qmth.sop.common.util.FileUtil;
|
|
import com.qmth.sop.common.util.GsonUtil;
|
|
import com.qmth.sop.common.util.GsonUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -728,6 +730,73 @@ public class TBDeviceDeliveryServiceImpl extends ServiceImpl<TBDeviceDeliveryMap
|
|
return deviceInOutFormList;
|
|
return deviceInOutFormList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<DeviceSignResult> signList(String crmNo) {
|
|
|
|
+ return baseMapper.listDeviceSign(crmNo,
|
|
|
|
+ Arrays.asList(DeviceDeliveryStatusEnum.DELIVER, DeviceDeliveryStatusEnum.USING));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void sign(String id, Long userId) {
|
|
|
|
+ TBDeviceDelivery deviceDelivery = getById(id);
|
|
|
|
+ if (Objects.isNull(deviceDelivery)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("设备发货记录不存在,ID:[%s]", id));
|
|
|
|
+ }
|
|
|
|
+ if (deviceDelivery.getStatus() != null && !deviceDelivery.getStatus()
|
|
|
|
+ .equals(DeviceDeliveryStatusEnum.DELIVER)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只能对未签收的设备做签收操作");
|
|
|
|
+ }
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
|
+ if (deviceDelivery.getSourceId() != null) {
|
|
|
|
+ TBDeviceDelivery sourceDeviceDelivery = getById(deviceDelivery.getSourceId());
|
|
|
|
+ if (Objects.isNull(sourceDeviceDelivery)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
|
+ String.format("找不到中转设备的发货来源, 发货ID:[%s]", deviceDelivery.getSourceId()));
|
|
|
|
+ }
|
|
|
|
+ //中转设备的源记录的状态,修改为:中转已签收
|
|
|
|
+ this.update(new UpdateWrapper<TBDeviceDelivery>().lambda()
|
|
|
|
+ .eq(TBDeviceDelivery::getId, deviceDelivery.getSourceId())
|
|
|
|
+ .set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.TRANSFER_SIGN)
|
|
|
|
+ .set(TBDeviceDelivery::getReceiveUserId, userId).set(TBDeviceDelivery::getReceiveTime, now)
|
|
|
|
+ .set(TBDeviceDelivery::getEffect, Boolean.FALSE).set(TBDeviceDelivery::getUpdateId, userId)
|
|
|
|
+ .set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+ }
|
|
|
|
+ //更新设备状态为使用中
|
|
|
|
+ this.update(new UpdateWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getId, id)
|
|
|
|
+ .set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.USING)
|
|
|
|
+ .set(TBDeviceDelivery::getReceiveUserId, userId).set(TBDeviceDelivery::getReceiveTime, now)
|
|
|
|
+ .set(TBDeviceDelivery::getUpdateId, userId).set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void unsigned(String id, Long userId) {
|
|
|
|
+ TBDeviceDelivery deviceDelivery = getById(id);
|
|
|
|
+ if (Objects.isNull(deviceDelivery)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("设备发货记录不存在,ID:[%s]", id));
|
|
|
|
+ }
|
|
|
|
+ if (deviceDelivery.getStatus() != null && !deviceDelivery.getStatus().equals(DeviceDeliveryStatusEnum.USING)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("只能对使用中的设备做未签收操作");
|
|
|
|
+ }
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
|
+ if (deviceDelivery.getSourceId() != null) {
|
|
|
|
+ TBDeviceDelivery sourceDeviceDelivery = getById(deviceDelivery.getSourceId());
|
|
|
|
+ if (Objects.isNull(sourceDeviceDelivery)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(
|
|
|
|
+ String.format("找不到中转设备的发货来源, 发货ID:[%s]", deviceDelivery.getSourceId()));
|
|
|
|
+ }
|
|
|
|
+ this.update(new UpdateWrapper<TBDeviceDelivery>().lambda()
|
|
|
|
+ .eq(TBDeviceDelivery::getId, deviceDelivery.getSourceId())
|
|
|
|
+ .set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.TRANSFER)
|
|
|
|
+ .set(TBDeviceDelivery::getEffect, Boolean.TRUE).set(TBDeviceDelivery::getUpdateId, userId)
|
|
|
|
+ .set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.update(new UpdateWrapper<TBDeviceDelivery>().lambda().eq(TBDeviceDelivery::getId, id)
|
|
|
|
+ .set(TBDeviceDelivery::getStatus, DeviceDeliveryStatusEnum.DELIVER)
|
|
|
|
+ .set(TBDeviceDelivery::getReceiveUserId, null).set(TBDeviceDelivery::getReceiveTime, null)
|
|
|
|
+ .set(TBDeviceDelivery::getUpdateId, userId).set(TBDeviceDelivery::getUpdateTime, now));
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 补充结果信息
|
|
* 补充结果信息
|
|
*
|
|
*
|