You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
4.0 KiB
Java
102 lines
4.0 KiB
Java
2 years ago
|
package com.glxp.api.controller.inout;
|
||
|
|
||
|
import cn.hutool.core.collection.CollUtil;
|
||
|
import cn.hutool.core.util.StrUtil;
|
||
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||
|
import com.glxp.api.common.enums.ResultEnum;
|
||
|
import com.glxp.api.common.res.BaseResponse;
|
||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||
|
import com.glxp.api.constant.ConstantStatus;
|
||
|
import com.glxp.api.controller.BaseController;
|
||
|
import com.glxp.api.entity.auth.AuthAdmin;
|
||
|
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||
|
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
|
||
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
||
|
import com.glxp.api.req.inout.ReviewFinishRequest;
|
||
|
import com.glxp.api.res.inout.AcceptOrderResponse;
|
||
|
import com.glxp.api.service.inout.IoAddInoutService;
|
||
|
import com.glxp.api.service.inout.IoCheckInoutService;
|
||
|
import com.glxp.api.service.inout.IoOrderDetailBizService;
|
||
|
import com.glxp.api.service.inout.IoOrderService;
|
||
|
import com.glxp.api.util.RedisUtil;
|
||
|
import lombok.extern.slf4j.Slf4j;
|
||
|
import org.springframework.validation.BindingResult;
|
||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import java.util.Date;
|
||
|
import java.util.List;
|
||
|
|
||
|
//单据验收
|
||
|
@Slf4j
|
||
|
@RestController
|
||
|
public class IoOrderReviewController extends BaseController {
|
||
|
|
||
|
@Resource
|
||
|
private RedisUtil redisUtil;
|
||
|
@Resource
|
||
|
IoOrderDetailBizService orderDetailBizService;
|
||
|
@Resource
|
||
|
IoOrderService orderService;
|
||
|
@Resource
|
||
|
IoCheckInoutService ioCheckInoutService;
|
||
|
|
||
|
//获取验收单据业务详情
|
||
|
@AuthRuleAnnotation("")
|
||
|
@GetMapping("/udiwms/stock/order/accept/getOrder")
|
||
|
public BaseResponse getAcceptOrder(String billNo) {
|
||
|
if (StrUtil.isBlank(billNo)) {
|
||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||
|
}
|
||
|
AcceptOrderResponse acceptOrderEntity = new AcceptOrderResponse();
|
||
|
acceptOrderEntity.setBillNo(billNo);
|
||
|
List<IoOrderDetailBizEntity> datas = (List<IoOrderDetailBizEntity>) redisUtil.get(ConstantStatus.REDIS_BILLNO + billNo);
|
||
|
if (CollUtil.isNotEmpty(datas)) {
|
||
|
acceptOrderEntity.setOrderDetailEntities(datas);
|
||
|
acceptOrderEntity.setExitAccept(true);
|
||
|
} else {
|
||
|
List<IoOrderDetailBizEntity> stockOrderDetailEntities = orderDetailBizService.findByOrderId(billNo);
|
||
|
acceptOrderEntity.setOrderDetailEntities(stockOrderDetailEntities);
|
||
|
acceptOrderEntity.setExitAccept(false);
|
||
|
}
|
||
|
return ResultVOUtils.success(acceptOrderEntity);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
//前端直接验收完成
|
||
|
@AuthRuleAnnotation("")
|
||
|
@PostMapping("/spms/inout/order/web/updateStatus")
|
||
|
public BaseResponse webUpdateStatus(@RequestBody ReviewFinishRequest updateExportStatusRequest,
|
||
|
BindingResult bindingResult) {
|
||
|
|
||
|
if (bindingResult.hasErrors()) {
|
||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||
|
}
|
||
|
IoOrderEntity orderEntity = orderService.findByBillNo(updateExportStatusRequest.getOrderId());
|
||
|
if (orderEntity == null) {
|
||
|
return ResultVOUtils.error(500, "未找到该业务单据");
|
||
|
}
|
||
|
return updateReview(orderEntity);
|
||
|
}
|
||
|
|
||
|
|
||
|
public BaseResponse updateReview(IoOrderEntity orderEntity) {
|
||
|
AuthAdmin authAdmin = getUser();
|
||
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_AUDITED);
|
||
|
orderEntity.setReviewUser(authAdmin.getId() + "");
|
||
|
orderEntity.setUpdateTime(new Date());
|
||
|
orderEntity.setAuditTime(new Date());
|
||
|
orderService.update(orderEntity);
|
||
|
redisUtil.del(ConstantStatus.REDIS_BILLNO + orderEntity.getBillNo());
|
||
|
redisUtil.del(ConstantStatus.REDIS_BILLNO_CODES + orderEntity.getBillNo());
|
||
|
//验收完成->进入流程
|
||
|
ioCheckInoutService.checkSecond(orderEntity);
|
||
|
return ResultVOUtils.success("更新成功");
|
||
|
}
|
||
|
|
||
|
}
|