|
|
|
@ -2,6 +2,8 @@ package com.glxp.api.controller.inout;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.exceptions.ExceptionUtil;
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.annotation.Log;
|
|
|
|
@ -35,6 +37,7 @@ import com.glxp.api.service.system.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.util.*;
|
|
|
|
|
import com.glxp.api.util.udi.UdiCalCountUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
@ -285,16 +288,38 @@ public class IoOrderReviewController extends BaseController {
|
|
|
|
|
redisUtil.del(ConstantStatus.REDIS_BILLNO_CODES + orderEntity.getBillNo());
|
|
|
|
|
return ResultVOUtils.success("验收成功!");
|
|
|
|
|
} else {
|
|
|
|
|
if (orderEntity.getFromType() == ConstantStatus.FROM_UDISP) {
|
|
|
|
|
ReviewFinishRequest reviewFinishRequest = new ReviewFinishRequest();
|
|
|
|
|
BeanUtil.copyProperties(updateExportStatusRequest, reviewFinishRequest);
|
|
|
|
|
updateSpmsStauts(reviewFinishRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return updateReview(authAdmin, orderEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
if (orderEntity.getFromType() == ConstantStatus.FROM_UDISP) {
|
|
|
|
|
ReviewFinishRequest reviewFinishRequest = new ReviewFinishRequest();
|
|
|
|
|
BeanUtil.copyProperties(updateExportStatusRequest, reviewFinishRequest);
|
|
|
|
|
updateSpmsStauts(reviewFinishRequest);
|
|
|
|
|
}
|
|
|
|
|
return updateReview(authAdmin, orderEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateSpmsStauts(ReviewFinishRequest reviewFinishRequest) {
|
|
|
|
|
ThreadUtil.execAsync(() -> {
|
|
|
|
|
try {
|
|
|
|
|
spGetHttp.reviewOrder(reviewFinishRequest, getUserId() + "");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error("下载异常", ExceptionUtils.getStackTrace(e));
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void transferOrder(IoOrderEntity orderEntity, EntrustReceEntity entrustReceEntity) {
|
|
|
|
|
List<IoCodeEntity> warehouseEntities = codeService.findByOrderId(orderEntity.getBillNo());
|
|
|
|
@ -477,7 +502,7 @@ public class IoOrderReviewController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
AcceptOrderResponse acceptOrderEntity = new AcceptOrderResponse();
|
|
|
|
|
Long userId = getUserId();
|
|
|
|
|
String errMsg = checkReviewAuth(billNo, userId + "");
|
|
|
|
|
String errMsg = checkReviewAuth(billNo, userId + "", reviewSpmsRequest.getAction());
|
|
|
|
|
if (StrUtil.isNotEmpty(errMsg)) {
|
|
|
|
|
if (errMsg.equals("委托验收")) {
|
|
|
|
|
acceptOrderEntity.setEntrust(true);
|
|
|
|
@ -554,8 +579,15 @@ public class IoOrderReviewController extends BaseController {
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private String checkReviewAuth(String orderId, String userId) {
|
|
|
|
|
private String checkReviewAuth(String orderId, String userId, String action) {
|
|
|
|
|
IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
|
|
|
|
|
if (StrUtil.isNotEmpty(action)) {
|
|
|
|
|
if (!orderEntity.getAction().equals(action)) {
|
|
|
|
|
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(action);
|
|
|
|
|
return "非" + bussinessTypeEntity.getName() + "单据,无法审核!";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderEntity == null) {
|
|
|
|
|
ReviewSpmsRequest reviewSpmsRequest = new ReviewSpmsRequest();
|
|
|
|
|
reviewSpmsRequest.setBillNo(orderId);
|
|
|
|
@ -569,12 +601,12 @@ public class IoOrderReviewController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_CHECK_REW && orderEntity.getStatus() != ConstantStatus.ORDER_STATUS_CHECK_SUCCESS) {
|
|
|
|
|
return "单据非未验收状态,无法审核!";
|
|
|
|
|
return "单据非未审核状态,无法审核!";
|
|
|
|
|
}
|
|
|
|
|
if (!invBusUserService.exitBus(userId, orderEntity.getAction())) {
|
|
|
|
|
EntrustReceEntity entrustReceEntity = entrustReceService.findByUnique(orderEntity.getAction(), Long.parseLong(userId));
|
|
|
|
|
if (entrustReceEntity == null) {
|
|
|
|
|
return "无验收权限!";
|
|
|
|
|
return "无审核权限!";
|
|
|
|
|
} else {
|
|
|
|
|
return "委托验收";
|
|
|
|
|
}
|
|
|
|
|