Merge remote-tracking branch 'origin/master'
commit
8d6ae5b67b
@ -0,0 +1,117 @@
|
||||
package com.glxp.api.controller.basic;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.controller.BaseController;
|
||||
import com.glxp.api.entity.basic.BasicBussinessTypeEntity;
|
||||
import com.glxp.api.entity.basic.DlEntrustReceEntity;
|
||||
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||||
import com.glxp.api.req.auth.BussinessTypeFilterRequest;
|
||||
import com.glxp.api.req.basic.BasicEntrustRecRequest;
|
||||
import com.glxp.api.req.basic.FilterBussinessTypeRequest;
|
||||
import com.glxp.api.req.system.DeleteRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.res.basic.EntrustReceResponse;
|
||||
import com.glxp.api.service.auth.CustomerService;
|
||||
import com.glxp.api.service.basic.EntrustReceService;
|
||||
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
public class EntrustReceController extends BaseController {
|
||||
|
||||
|
||||
@Resource
|
||||
EntrustReceService entrustReceService;
|
||||
@Resource
|
||||
CustomerService customerService;
|
||||
@Resource
|
||||
private IBasicBussinessTypeService bussinessTypeService;
|
||||
|
||||
@GetMapping("/spms/entrust/rece/filter")
|
||||
public BaseResponse getEntrustRece(BasicEntrustRecRequest basicExportStatusRequest) {
|
||||
List<EntrustReceResponse> entrustReceEntities = entrustReceService.filterJoinEntrustRec(basicExportStatusRequest);
|
||||
PageInfo<EntrustReceResponse> pageInfo;
|
||||
pageInfo = new PageInfo<>(entrustReceEntities);
|
||||
PageSimpleResponse<EntrustReceResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(entrustReceEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
//手持终端下载委托验收
|
||||
@GetMapping("/spms/entrust/rece/downloads")
|
||||
public BaseResponse downloadEntrust(BasicEntrustRecRequest basicExportStatusRequest) {
|
||||
basicExportStatusRequest.setEntrustUser(getUserId());
|
||||
List<DlEntrustReceEntity> entrustReceEntities = entrustReceService.downloadEntrustRec(basicExportStatusRequest);
|
||||
PageInfo<DlEntrustReceEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(entrustReceEntities);
|
||||
PageSimpleResponse<DlEntrustReceEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(entrustReceEntities);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/spms/entrust/rece/filterAllNoUse")
|
||||
public BaseResponse filterAllNoUse(FilterBussinessTypeRequest bussinessTypeFilterRequest) {
|
||||
bussinessTypeFilterRequest.setUserId(getUserId());
|
||||
List<BasicBussinessTypeEntity> bussinessTypeEntities = bussinessTypeService.filterByUser(bussinessTypeFilterRequest);
|
||||
return ResultVOUtils.success(bussinessTypeEntities);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/spms/entrust/rece/add")
|
||||
public BaseResponse aadEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
|
||||
entrustReceEntity.setUserId(getUserId());
|
||||
entrustReceEntity.setUpdateTime(new Date());
|
||||
|
||||
EntrustReceEntity temp = entrustReceService.findByUnique(entrustReceEntity.getAction(), entrustReceEntity.getEntrustUser());
|
||||
if (temp != null) {
|
||||
return ResultVOUtils.error(500, "已存在相同的委托验收");
|
||||
}
|
||||
int b = entrustReceService.insertEntrustRec(entrustReceEntity);
|
||||
if (b > 0) {
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
} else {
|
||||
return ResultVOUtils.error(500, "添加失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/spms/entrust/rece/update")
|
||||
public BaseResponse updateEntrustRece(@RequestBody EntrustReceEntity entrustReceEntity) {
|
||||
entrustReceEntity.setUpdateTime(new Date());
|
||||
|
||||
|
||||
int b = entrustReceService.updateEntrustRec(entrustReceEntity);
|
||||
if (b > 0) {
|
||||
return ResultVOUtils.success("添加成功!");
|
||||
} else {
|
||||
return ResultVOUtils.error(500, "添加失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/spms/entrust/rece/delete")
|
||||
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
|
||||
|
||||
boolean b = entrustReceService.deleteById(deleteRequest.getId());
|
||||
if (b)
|
||||
return ResultVOUtils.success("删除成功!");
|
||||
else
|
||||
return ResultVOUtils.error(500, "删除失败!");
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
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("更新成功");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.glxp.api.dao.basic;
|
||||
|
||||
import com.glxp.api.dao.BaseMapperPlus;
|
||||
import com.glxp.api.entity.basic.DlEntrustReceEntity;
|
||||
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||||
import com.glxp.api.req.basic.BasicEntrustRecRequest;
|
||||
import com.glxp.api.res.basic.EntrustReceResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface EntrustReceDao extends BaseMapperPlus<EntrustReceDao, EntrustReceEntity, EntrustReceEntity> {
|
||||
|
||||
List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
List<EntrustReceResponse> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
EntrustReceEntity findByUnique(@Param("action") String action, @Param("entrustUser") Long entrustUser);
|
||||
|
||||
boolean insertEntrustRec(EntrustReceEntity ioOrderStatusEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean deleteAll();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.glxp.api.entity.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DlEntrustReceEntity {
|
||||
|
||||
|
||||
private Integer id;
|
||||
private String action;
|
||||
private String name;
|
||||
private String mainAction;
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.glxp.api.entity.basic;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.apache.xpath.operations.Bool;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName(value = "basic_entrust_accept")
|
||||
public class EntrustReceEntity {
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 当前单据类型
|
||||
*/
|
||||
@TableField(value = "`action`")
|
||||
private String action;
|
||||
|
||||
/**
|
||||
* 当前部门
|
||||
*/
|
||||
@TableField(value = "curDept")
|
||||
private String curDept;
|
||||
|
||||
/**
|
||||
* 当前仓库
|
||||
*/
|
||||
@TableField(value = "curInv")
|
||||
private String curInv;
|
||||
|
||||
/**
|
||||
* 当前用户
|
||||
*/
|
||||
@TableField(value = "userId")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 委托分库
|
||||
*/
|
||||
@TableField(value = "entrustDept")
|
||||
private String entrustDept;
|
||||
|
||||
/**
|
||||
* 委托人仓库
|
||||
*/
|
||||
@TableField(value = "entrustInv")
|
||||
private String entrustInv;
|
||||
|
||||
/**
|
||||
* 委托验收后生成单据类型
|
||||
*/
|
||||
@TableField(value = "entrustAction")
|
||||
private String entrustAction;
|
||||
|
||||
/**
|
||||
* 委托人用户
|
||||
*/
|
||||
@TableField(value = "entrustUser")
|
||||
private Long entrustUser;
|
||||
|
||||
/**
|
||||
* 是否完成验收
|
||||
*/
|
||||
@TableField(value = "finishRece")
|
||||
private Boolean finishRece;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(value = "updateTime")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否委托验收完成
|
||||
*/
|
||||
@TableField(value = "entrustEnd")
|
||||
private Integer entrustEnd;
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_ACTION = "action";
|
||||
|
||||
public static final String COL_CURDEPT = "curDept";
|
||||
|
||||
public static final String COL_CURINV = "curInv";
|
||||
|
||||
public static final String COL_USERID = "userId";
|
||||
|
||||
public static final String COL_ENTRUSTDEPT = "entrustDept";
|
||||
|
||||
public static final String COL_ENTRUSTINV = "entrustInv";
|
||||
|
||||
public static final String COL_ENTRUSTACTION = "entrustAction";
|
||||
|
||||
public static final String COL_ENTRUSTUSER = "entrustUser";
|
||||
|
||||
public static final String COL_FINISHRECE = "finishRece";
|
||||
|
||||
public static final String COL_UPDATETIME = "updateTime";
|
||||
|
||||
public static final String COL_REMARK = "remark";
|
||||
|
||||
public static final String COL_ENTRUSTEND = "entrustEnd";
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.glxp.api.req.basic;
|
||||
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class BasicEntrustRecRequest extends ListPageRequest {
|
||||
|
||||
private Integer id;
|
||||
private String action;
|
||||
private String entrustInv;
|
||||
private Long entrustUser;
|
||||
private String userId;
|
||||
private Date updateTime;
|
||||
private String curInv;
|
||||
private String lastUpdateTime;
|
||||
private String entrustSubInv;
|
||||
private String invWarehouseCode;
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.glxp.api.req.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusNoUserRequest {
|
||||
|
||||
private String curAction;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.glxp.api.req.inout;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ReviewFinishRequest {
|
||||
private String orderId;
|
||||
private Integer exportStatus;
|
||||
private Integer checkStatus;
|
||||
private String stockOrderId;
|
||||
private Integer entrustId;
|
||||
private boolean entrust;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.glxp.api.res.basic;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class EntrustReceResponse {
|
||||
private Integer id;
|
||||
private String action;
|
||||
private String entrustInv;
|
||||
private Long entrustUser;
|
||||
private String userId;
|
||||
private String entrustAction;
|
||||
private Date updateTime;
|
||||
private String remark;
|
||||
private boolean finishRece;
|
||||
private String curName;
|
||||
|
||||
private String entrustName;
|
||||
|
||||
/**
|
||||
* 委托验收人
|
||||
*/
|
||||
private String employeeName;
|
||||
|
||||
/**
|
||||
* 分库名称
|
||||
*/
|
||||
private String entrustInvName;
|
||||
|
||||
/**
|
||||
* 当前仓库编码
|
||||
*/
|
||||
private String curInv;
|
||||
|
||||
/**
|
||||
* 当前仓库名称
|
||||
*/
|
||||
private String curInvName;
|
||||
|
||||
/**
|
||||
* 委托分库编码
|
||||
*/
|
||||
private String entrustSubInv;
|
||||
|
||||
/**
|
||||
* 当前分库编码
|
||||
*/
|
||||
private String invWarehouseCode;
|
||||
|
||||
/**
|
||||
* 当前分库名称
|
||||
*/
|
||||
private String invWarehouseName;
|
||||
|
||||
/**
|
||||
* 委托分库名称
|
||||
*/
|
||||
private String entrustSubInvName;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.glxp.api.res.inout;
|
||||
|
||||
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AcceptOrderResponse {
|
||||
|
||||
|
||||
private String billNo;
|
||||
|
||||
private String code;
|
||||
|
||||
private boolean isExitAccept;
|
||||
|
||||
private boolean finishAccept;
|
||||
|
||||
private List<IoOrderDetailBizEntity> orderDetailEntities;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.glxp.api.service.basic;
|
||||
|
||||
import com.glxp.api.entity.basic.DlEntrustReceEntity;
|
||||
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||||
import com.glxp.api.req.basic.BasicEntrustRecRequest;
|
||||
import com.glxp.api.res.basic.EntrustReceResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EntrustReceService {
|
||||
|
||||
EntrustReceEntity findById(Integer id);
|
||||
|
||||
List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
EntrustReceEntity findByUnique(String action, Long entrustUser);
|
||||
|
||||
List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
List<EntrustReceResponse> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest);
|
||||
|
||||
int insertEntrustRec(EntrustReceEntity entrustReceEntity);
|
||||
|
||||
boolean replaceEntrustRec(EntrustReceEntity entrustReceEntity);
|
||||
|
||||
boolean deleteById(String id);
|
||||
|
||||
boolean deleteAll();
|
||||
|
||||
int updateEntrustRec(EntrustReceEntity warehouseEntity);
|
||||
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
package com.glxp.api.service.basic.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.auth.InvSubWarehouseDao;
|
||||
import com.glxp.api.dao.basic.EntrustReceDao;
|
||||
import com.glxp.api.entity.basic.DlEntrustReceEntity;
|
||||
import com.glxp.api.entity.basic.EntrustReceEntity;
|
||||
import com.glxp.api.req.basic.BasicEntrustRecRequest;
|
||||
import com.glxp.api.res.basic.EntrustReceResponse;
|
||||
import com.glxp.api.service.basic.EntrustReceService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class EntrustReceServiceImpl implements EntrustReceService {
|
||||
|
||||
@Resource
|
||||
EntrustReceDao entrustReceDao;
|
||||
@Resource
|
||||
private InvSubWarehouseDao invSubWarehouseDao;
|
||||
|
||||
@Override
|
||||
public EntrustReceEntity findById(Integer id) {
|
||||
BasicEntrustRecRequest basicEntrustRecRequest = new BasicEntrustRecRequest();
|
||||
basicEntrustRecRequest.setId(id);
|
||||
List<EntrustReceEntity> entrustReceEntities = entrustReceDao.filterEntrustRec(basicEntrustRecRequest);
|
||||
if (CollUtil.isNotEmpty(entrustReceEntities)) {
|
||||
return entrustReceEntities.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntrustReceEntity> filterEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
|
||||
|
||||
if (basicEntrustRecRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (basicEntrustRecRequest.getPage() != null) {
|
||||
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
|
||||
}
|
||||
return entrustReceDao.filterEntrustRec(basicEntrustRecRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntrustReceEntity findByUnique(String action, Long entrustUser) {
|
||||
return entrustReceDao.findByUnique(action, entrustUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DlEntrustReceEntity> downloadEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
|
||||
if (basicEntrustRecRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (basicEntrustRecRequest.getPage() != null) {
|
||||
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
|
||||
}
|
||||
return entrustReceDao.downloadEntrustRec(basicEntrustRecRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EntrustReceResponse> filterJoinEntrustRec(BasicEntrustRecRequest basicEntrustRecRequest) {
|
||||
|
||||
if (basicEntrustRecRequest == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (basicEntrustRecRequest.getPage() != null) {
|
||||
int offset = (basicEntrustRecRequest.getPage() - 1) * basicEntrustRecRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, basicEntrustRecRequest.getLimit());
|
||||
}
|
||||
List<EntrustReceResponse> entrustReceResponses = entrustReceDao.filterJoinEntrustRec(basicEntrustRecRequest);
|
||||
if (CollUtil.isNotEmpty(entrustReceResponses)) {
|
||||
//查询当前分库名称和委托验收分库名称
|
||||
entrustReceResponses.forEach(entrustReceResponse -> {
|
||||
String invWarehouseName = invSubWarehouseDao.selectNameByCode(entrustReceResponse.getInvWarehouseCode());//查询当前分库名称
|
||||
entrustReceResponse.setInvWarehouseName(invWarehouseName);
|
||||
|
||||
String entrustSubInvName = invSubWarehouseDao.selectNameByCode(entrustReceResponse.getEntrustSubInv());
|
||||
entrustReceResponse.setEntrustSubInvName(entrustSubInvName);
|
||||
});
|
||||
}
|
||||
return entrustReceResponses;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertEntrustRec(EntrustReceEntity entrustReceEntity) {
|
||||
return entrustReceDao.insert(entrustReceEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEntrustRec(EntrustReceEntity entrustReceEntity) {
|
||||
return entrustReceDao.insertEntrustRec(entrustReceEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteById(String id) {
|
||||
return entrustReceDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteAll() {
|
||||
return entrustReceDao.deleteAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateEntrustRec(EntrustReceEntity entrustReceEntity) {
|
||||
return entrustReceDao.updateById(entrustReceEntity);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.glxp.api.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.glxp.api.dao.schedule.ScheduledDao;
|
||||
import com.glxp.api.entity.inout.IoOrderEntity;
|
||||
import com.glxp.api.entity.system.ScheduledEntity;
|
||||
import com.glxp.api.entity.system.SystemParamConfigEntity;
|
||||
import com.glxp.api.req.system.ScheduledRequest;
|
||||
import com.glxp.api.res.inout.IoOrderResponse;
|
||||
import com.glxp.api.service.inout.IoAddInoutService;
|
||||
import com.glxp.api.service.inout.IoOrderService;
|
||||
import com.glxp.api.service.system.SystemParamConfigService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
import org.springframework.scheduling.support.CronTrigger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 自动补单定时任务
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@EnableScheduling
|
||||
public class SupplementOrderTask implements SchedulingConfigurer {
|
||||
|
||||
@Resource
|
||||
ScheduledDao scheduledDao;
|
||||
@Resource
|
||||
IoOrderService orderService;
|
||||
@Resource
|
||||
SystemParamConfigService systemParamConfigService;
|
||||
@Resource
|
||||
IoAddInoutService addInoutService;
|
||||
|
||||
@Override
|
||||
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||
taskRegistrar.addTriggerTask(() -> process(),
|
||||
triggerContext -> {
|
||||
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||
scheduledRequest.setCronName("supplementOrderTask");
|
||||
ScheduledEntity scheduledEntity = scheduledDao.findScheduled(scheduledRequest);
|
||||
if (scheduledEntity == null) {
|
||||
log.error("定时任务未配置,请注意!");
|
||||
return null;
|
||||
}
|
||||
String cron = scheduledEntity.getCron();
|
||||
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||
});
|
||||
}
|
||||
|
||||
private void process() {
|
||||
|
||||
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("supplement_order_interval");
|
||||
if (!"0".equals(systemParamConfigEntity.getParamValue())) {
|
||||
log.info("开始扫描需要平衡补单数据");
|
||||
//计数器
|
||||
AtomicInteger counter = new AtomicInteger(0);
|
||||
List<IoOrderEntity> orderEntities = orderService.selectSupplementOrderList();
|
||||
if (CollUtil.isNotEmpty(orderEntities)) {
|
||||
List<IoOrderResponse> orderResponses = orderService.checkSupplementOrder(orderEntities);
|
||||
for (IoOrderResponse orderResponse : orderResponses) {
|
||||
if (orderResponse.isEnableSupplementOrder()) {
|
||||
//此单据可以补单
|
||||
addInoutService.supplementOrder(orderResponse.getBillNo());
|
||||
counter.addAndGet(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info("平衡补单,此次补单数量为:{}", counter.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
|
||||
<mapper namespace="com.glxp.api.dao.basic.EntrustReceDao">
|
||||
<select id="filterEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
|
||||
resultType="com.glxp.api.entity.basic.EntrustReceEntity">
|
||||
select *
|
||||
from basic_entrust_accept
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
and `action` = #{action}
|
||||
</if>
|
||||
<if test="entrustInv != null">
|
||||
and entrustInv = #{entrustInv}
|
||||
</if>
|
||||
<if test="entrustUser != '' and entrustUser != null">
|
||||
and entrustUser = #{entrustUser}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and userId = #{userId}
|
||||
</if>
|
||||
<if test="curInv != null">
|
||||
and curInv = #{curInv}
|
||||
</if>
|
||||
<if test="entrustSubInv != null">
|
||||
and entrustSubInv = #{entrustSubInv}
|
||||
</if>
|
||||
<if test="invWarehouseCode != null">
|
||||
and invWarehouseCode = #{invWarehouseCode}
|
||||
</if>
|
||||
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(updateTime
|
||||
, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}
|
||||
, '%Y-%m-%d %H:%i:%S')
|
||||
]]>
|
||||
</if>
|
||||
</where>
|
||||
order by updateTime desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findByUnique" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
|
||||
resultType="com.glxp.api.entity.basic.EntrustReceEntity">
|
||||
select *
|
||||
from basic_entrust_accept
|
||||
where `action` = #{action}
|
||||
and `entrustUser` = #{entrustUser} limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="downloadEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
|
||||
resultType="com.glxp.api.entity.basic.DlEntrustReceEntity">
|
||||
select basic_entrust_accept.id,
|
||||
b.name,
|
||||
b.action,
|
||||
b.mainAction
|
||||
from basic_entrust_accept
|
||||
INNER JOIN basic_bussiness_type b on a.action = b.action
|
||||
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
and basic_entrust_accept.action = #{action}
|
||||
</if>
|
||||
<if test="entrustInv != null">
|
||||
and basic_entrust_accept.entrustInv = #{entrustInv}
|
||||
</if>
|
||||
<if test="entrustUser != '' and entrustUser != null">
|
||||
and basic_entrust_accept.entrustUser = #{entrustUser}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and basic_entrust_accept.userId = #{userId}
|
||||
</if>
|
||||
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
||||
<![CDATA[
|
||||
and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S') >= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
|
||||
]]>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="filterJoinEntrustRec" parameterType="com.glxp.api.req.basic.BasicEntrustRecRequest"
|
||||
resultType="com.glxp.api.res.basic.EntrustReceResponse">
|
||||
select basic_entrust_accept.*,
|
||||
a.name as curName,
|
||||
b.name as entrustName,
|
||||
auth_user.employeeName,
|
||||
c.name as entrustInvName,
|
||||
d.name as curInvName
|
||||
from basic_entrust_accept
|
||||
LEFT JOIN basic_bussiness_type a on basic_entrust_accept.action = a.action
|
||||
LEFT JOIN basic_bussiness_type b on basic_entrust_accept.entrustAction = b.action
|
||||
LEFT JOIN auth_user on basic_entrust_accept.entrustUser = auth_user.id
|
||||
LEFT JOIN auth_warehouse c on basic_entrust_accept.entrustInv = c.`code`
|
||||
LEFT JOIN auth_warehouse d on basic_entrust_accept.curInv = d.`code`
|
||||
<where>
|
||||
<if test="id != '' and id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="action != null">
|
||||
and action = #{action}
|
||||
</if>
|
||||
<if test="entrustInv != null">
|
||||
and entrustInv = #{entrustInv}
|
||||
</if>
|
||||
<if test="entrustUser != '' and entrustUser != null">
|
||||
and entrustUser = #{entrustUser}
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
and userId = #{userId}
|
||||
</if>
|
||||
<if test="curInv != null">
|
||||
and curInv = #{curInv}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
and a.name like concat('%'
|
||||
, #{name}
|
||||
, '%')
|
||||
</if>
|
||||
</where>
|
||||
group by basic_entrust_accept.id
|
||||
order by updateTime desc
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertEntrustRec" keyProperty="id"
|
||||
parameterType="com.glxp.api.entity.basic.EntrustReceEntity">
|
||||
replace
|
||||
INTO basic_entrust_accept(`action`,curDept, entrustInv, `entrustUser`, userId,
|
||||
updateTime, remark,entrustAction,finishRece,curInv,entrustDept,entrustInv,entrustEnd)
|
||||
values (
|
||||
#{action},
|
||||
#{entrustInv},
|
||||
#{entrustUser},
|
||||
#{userId},
|
||||
#{updateTime},
|
||||
#{remark},
|
||||
#{entrustAction},
|
||||
#{finishRece},
|
||||
#{curInv},
|
||||
#{entrustDept},
|
||||
#{entrustInv},
|
||||
#{entrustEnd}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_entrust_accept
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAll" parameterType="Map">
|
||||
DELETE
|
||||
FROM basic_entrust_accept
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue