切换分支物资管理系统备份

purchase
anthonyywj2 3 years ago
parent 43c2b5a72e
commit 9054f3f250

@ -0,0 +1,27 @@
package com.glxp.api.admin.annotation;
import java.lang.annotation.*;
import java.util.concurrent.TimeUnit;
/**
*
*/
@Inherited
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RepeatSubmit {
/**
* (ms)
*/
int interval() default 5000;
TimeUnit timeUnit() default TimeUnit.MILLISECONDS;
/**
* {code}
*/
String message() default "{repeat.submit.message}";
}

@ -12,6 +12,8 @@ public class Constant {
public static final String SCAN_ORDER = "MS";
public static final String BUS_ORDER = "MY";
public static final String LIN_YONG = "ML";
public static final String SG_ORDER = "SG";
public static final String JH_ORDER = "JH";
public static final String dlThrProducts = "THR_DOWNLOAD_PRODUCTS";
public static final String dlThrInvProducts = "THR_DOWNLOAD_INV_PRODUCTS";

@ -150,4 +150,9 @@ public class ConstantStatus {
public static final String REDIS_BILLNO = "ACCEPT_"; //缓存单据前缀
public static final String REDIS_BILLNO_CODES = "ACCEPT_CODES";
public static final int APPLY_DRAFT = 1;//草稿
public static final int APPLY_UN_AUDIT = 2;//未审核
public static final int APPLY_AUDIT_ED = 3;//已审核
}

@ -0,0 +1,197 @@
package com.glxp.api.admin.controller.purchase;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.annotation.AuthRuleAnnotation;
import com.glxp.api.admin.annotation.RepeatSubmit;
import com.glxp.api.admin.constant.Constant;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.req.purchase.PostPurApplyRequest;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import com.glxp.api.admin.req.purchase.PurApplyRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.auth.CustomerService;
import com.glxp.api.admin.service.purchase.IPurApplyDetailService;
import com.glxp.api.admin.service.purchase.IPurApplyService;
import com.glxp.api.admin.util.GennerOrderUtils;
import com.glxp.api.admin.util.MyStrUtil;
import com.glxp.api.admin.util.OrderNoTypeBean;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* pur
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/purchase/apply")
public class PurApplyController {
@Resource
IPurApplyService purApplyService;
@Resource
IPurApplyDetailService purApplyDetailService;
@Resource
CustomerService customerService;
@Resource
GennerOrderUtils gennerOrderUtils;
/**
*
*/
@RepeatSubmit()
@AuthRuleAnnotation("")
@PostMapping("/postOrder")
public BaseResponse postOrder(@RequestBody PostPurApplyRequest postPurApplyRequest) {
Integer userId = customerService.getUserId();
PurApplyEntity purApplyEntity = postPurApplyRequest.getPurApplyEntity();
purApplyEntity.setCreateBy(userId + "");
purApplyEntity.setCreateTime(new Date());
purApplyEntity.setUpdateTime(new Date());
purApplyEntity.setStatus(postPurApplyRequest.getEditStatus()); //草稿状态
if (purApplyEntity.getId() == null) {
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
purApplyEntity.setBillNo(billNo);
purApplyService.insert(purApplyEntity);
} else {
purApplyService.update(purApplyEntity);
if (CollUtil.isNotEmpty(postPurApplyRequest.getSubErpOrders())) {
purApplyDetailService.deleteByOrderId(purApplyEntity.getId() + "");
}
}
if (CollUtil.isNotEmpty(postPurApplyRequest.getSubErpOrders())) {
for (StockOrderDetailEntity stockOrderDetailEntity : postPurApplyRequest.getSubErpOrders()) {
PurApplyDetailEntity purApplyDetailEntity = new PurApplyDetailEntity();
BeanUtils.copyProperties(stockOrderDetailEntity, purApplyDetailEntity);
purApplyDetailEntity.setOrderIdFk(purApplyEntity.getId() + "");
purApplyDetailService.insert(purApplyDetailEntity);
}
}
return ResultVOUtils.success("提交成功!");
}
/**
*
*/
@GetMapping("/list")
public BaseResponse list(PurApplyRequest purApplyRequest) {
List<PurApplyEntity> purApplyEntities = purApplyService.queryPageList(purApplyRequest);
PageInfo<PurApplyEntity> pageInfo;
pageInfo = new PageInfo<>(purApplyEntities);
PageSimpleResponse<PurApplyEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(purApplyEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*/
@RepeatSubmit()
@PostMapping()
public BaseResponse add(@RequestBody PurApplyEntity purApplyRequest) {
purApplyService.insert(purApplyRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@RepeatSubmit()
@PutMapping()
public BaseResponse edit(@RequestBody PurApplyEntity purApplyRequest) {
purApplyService.update(purApplyRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*
* @param ids
*/
@DeleteMapping("/{ids}")
public BaseResponse remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
purApplyService.deleteByIds(Arrays.asList(ids));
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@GetMapping("/list/detail")
public BaseResponse detailList(PurApplyDetailRequest purApplyDetailRequest) {
List<StockOrderDetailEntity> purApplyDetailEntities = purApplyDetailService.joinQueryList(purApplyDetailRequest);
PageInfo<StockOrderDetailEntity> pageInfo;
pageInfo = new PageInfo<>(purApplyDetailEntities);
PageSimpleResponse<StockOrderDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(purApplyDetailEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*/
@RepeatSubmit()
@PostMapping("/detail")
public BaseResponse detailAdd(@RequestBody PurApplyDetailEntity purApplyDetailRequest) {
purApplyDetailService.insert(purApplyDetailRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@RepeatSubmit()
@PutMapping("/detail")
public BaseResponse detailEdit(@RequestBody PurApplyDetailEntity purApplyDetailRequest) {
purApplyDetailService.update(purApplyDetailRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*
* @param ids
*/
@DeleteMapping("/detail/{ids}")
public BaseResponse detailRemove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
purApplyDetailService.deleteByIds(Arrays.asList(ids));
return ResultVOUtils.success("删除成功");
}
}

@ -0,0 +1,144 @@
package com.glxp.api.admin.controller.purchase;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.annotation.RepeatSubmit;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import com.glxp.api.admin.req.purchase.PurPlanDetailRequest;
import com.glxp.api.admin.req.purchase.PurPlanRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.purchase.IPurPlanDetailService;
import com.glxp.api.admin.service.purchase.IPurPlanService;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.List;
/**
* pur
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/purchase/plan")
public class PurPlanController {
@Resource
IPurPlanService purPlanService;
@Resource
IPurPlanDetailService purPlanDetailService;
/**
*
*/
@GetMapping("/list")
public BaseResponse list(PurPlanRequest purPlanRequest) {
List<PurPlanEntity> purApplyEntities = purPlanService.queryPageList(purPlanRequest);
PageInfo<PurPlanEntity> pageInfo;
pageInfo = new PageInfo<>(purApplyEntities);
PageSimpleResponse<PurPlanEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(purApplyEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*/
@RepeatSubmit()
@PostMapping()
public BaseResponse add(@RequestBody PurPlanRequest purApplyRequest) {
purPlanService.insert(purApplyRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@RepeatSubmit()
@PutMapping()
public BaseResponse edit(@RequestBody PurPlanRequest purApplyRequest) {
purPlanService.update(purApplyRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*
* @param ids
*/
@DeleteMapping("/{ids}")
public BaseResponse remove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
purPlanService.deleteByIds(Arrays.asList(ids));
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@GetMapping("/list/detail")
public BaseResponse detailList(PurPlanDetailRequest purPlanDetailRequest) {
List<PurPlanDetailEntity> purApplyDetailEntities = purPlanDetailService.queryPageList(purPlanDetailRequest);
PageInfo<PurPlanDetailEntity> pageInfo;
pageInfo = new PageInfo<>(purApplyDetailEntities);
PageSimpleResponse<PurPlanDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(purApplyDetailEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
/**
*
*/
@RepeatSubmit()
@PostMapping("/detail")
public BaseResponse detailAdd(@RequestBody PurPlanDetailRequest purPlanDetailRequest) {
purPlanDetailService.insert(purPlanDetailRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*/
@RepeatSubmit()
@PutMapping("/detail")
public BaseResponse detailEdit(@RequestBody PurPlanDetailRequest purPlanDetailRequest) {
purPlanDetailService.update(purPlanDetailRequest);
return ResultVOUtils.success("删除成功");
}
/**
*
*
* @param ids
*/
@DeleteMapping("/detail/{ids}")
public BaseResponse detailRemove(@NotEmpty(message = "主键不能为空")
@PathVariable Long[] ids) {
purPlanDetailService.deleteByIds(Arrays.asList(ids));
return ResultVOUtils.success("删除成功");
}
}

@ -0,0 +1,21 @@
package com.glxp.api.admin.dao.purchase;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.req.purchase.PurApplyRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PurApplyDao {
List<PurApplyEntity> queryPageList(PurApplyRequest purApplyRequest);
Integer insert(PurApplyEntity purApplyRequest);
Boolean update(PurApplyEntity purApplyRequest);
Boolean deleteByIds(@Param("ids") List<Long> ids);
}

@ -0,0 +1,26 @@
package com.glxp.api.admin.dao.purchase;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface PurApplyDetailDao {
List<PurApplyDetailEntity> queryPageList(PurApplyDetailRequest purApplyRequest);
List<StockOrderDetailEntity> joinQueryList(PurApplyDetailRequest purApplyRequest);
Boolean insert(PurApplyDetailEntity purApplyDetailEntity);
Boolean update(PurApplyDetailEntity purApplyRequest);
Boolean deleteByIds(List<Long> ids);
Boolean deleteByOrderId(@Param("orderIdFk") String orderIdFk);
}

@ -0,0 +1,20 @@
package com.glxp.api.admin.dao.purchase;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurPlanRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PurPlanDao {
List<PurPlanEntity> queryPageList(PurPlanRequest purPlanRequest);
Boolean insert(PurPlanRequest purPlanRequest);
Boolean update(PurPlanRequest purPlanRequest);
Boolean deleteByIds(List<Long> ids);
}

@ -0,0 +1,18 @@
package com.glxp.api.admin.dao.purchase;
import com.glxp.api.admin.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.admin.req.purchase.PurPlanDetailRequest;
import java.util.List;
public interface PurPlanDetailDao {
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purPlanDetailRequest);
Boolean insert(PurPlanDetailRequest purPlanDetailRequest);
Boolean update(PurPlanDetailRequest purPlanDetailRequest);
Boolean deleteByIds(List<Long> ids);
}

@ -43,6 +43,7 @@ public class StockOrderDetailEntity {
private Integer codeId;
private int acceptCount;
private String measname;
}

@ -0,0 +1,35 @@
package com.glxp.api.admin.entity.purchase;
import lombok.Data;
@Data
public class PurApplyDetailEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
*
*/
private String orderIdFk;
/**
* ID
*/
private String productId;
/**
*
*/
private String productName;
/**
*
*/
private Integer count;
/**
* ID
*/
private String supId;
}

@ -0,0 +1,73 @@
package com.glxp.api.admin.entity.purchase;
import lombok.Data;
import java.util.Date;
/**
* pur pur_apply
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Data
public class PurApplyEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Integer id;
/**
*
*/
private String billNo;
/**
*
*/
private Date billDate;
/**
* 1.稿2.3.
*/
private int status;
/**
*
*/
private Long billType;
/**
*
*/
private String remark;
/**
*
*/
private String locStorageCode;
/**
*
*/
private String invWarehouseCode;
/**
*
*/
private String deptCode;
/**
*
*/
private String auditBy;
/**
*
*/
private Date auditTime;
private String createBy;
/**
*
*/
private Date createTime;
private Date updateTime;
}

@ -0,0 +1,35 @@
package com.glxp.api.admin.entity.purchase;
import lombok.Data;
@Data
public class PurPlanDetailEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
*
*/
private String orderIdFk;
/**
* ID
*/
private Long productId;
/**
*
*/
private String productName;
/**
*
*/
private Long count;
/**
* ID
*/
private String supId;
}

@ -0,0 +1,74 @@
package com.glxp.api.admin.entity.purchase;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* pur pur_plan
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Data
public class PurPlanEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long id;
/**
*
*/
private String billNo;
/**
*
*/
private Date billDate;
/**
* 1.稿2.3.
*/
private Long status;
/**
*
*/
private Long billType;
/**
*
*/
private String remark;
/**
*
*/
private String locStorageCode;
/**
*
*/
private String invWarehouseCode;
/**
*
*/
private String deptCode;
/**
*
*/
private String auditBy;
/**
*
*/
private Date auditTime;
private String createBy;
/**
*
*/
private Date createTime;
}

@ -0,0 +1,18 @@
package com.glxp.api.admin.req.purchase;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import lombok.Data;
import java.util.List;
@Data
public class PostPurApplyRequest {
int editStatus;
PurApplyEntity purApplyEntity;
List<PurApplyDetailEntity> purApplyDetailEntities;
List<StockOrderDetailEntity> subErpOrders;
}

@ -0,0 +1,53 @@
package com.glxp.api.admin.req.purchase;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* @author anthony.ywj
* @date 2022-10-12
*/
@Data
public class PurApplyDetailRequest extends ListPageRequest {
/**
*
*/
@NotNull(message = "不能为空")
private Long id;
/**
*
*/
@NotBlank(message = "订单外键不能为空")
private String orderIdFk;
/**
* ID
*/
@NotNull(message = "产品ID不能为空")
private Long productId;
/**
*
*/
@NotBlank(message = "产品名称不能为空")
private String productName;
/**
*
*/
@NotNull(message = "数量不能为空")
private Long count;
/**
* ID
*/
@NotBlank(message = "供应商ID不能为空")
private String supId;
}

@ -0,0 +1,97 @@
package com.glxp.api.admin.req.purchase;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* pur pur_apply
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Data
public class PurApplyRequest extends ListPageRequest {
/**
*
*/
@NotNull(message = "不能为空")
private Long id;
/**
*
*/
@NotBlank(message = "单据号不能为空")
private String billNo;
/**
*
*/
@NotNull(message = "单据日期不能为空")
private Date billDate;
/**
* 1.稿2.3.
*/
@NotNull(message = "状态1.草稿2.未审核3.已审核)不能为空")
private Long status;
/**
*
*/
@NotNull(message = "申购类型不能为空")
private Long billType;
/**
*
*/
@NotBlank(message = "申购说明不能为空")
private String remark;
/**
*
*/
@NotBlank(message = "当前仓库不能为空")
private String locStorageCode;
/**
*
*/
@NotBlank(message = "当前分库不能为空")
private String invWarehouseCode;
/**
*
*/
@NotBlank(message = "所属部门不能为空")
private String deptCode;
/**
*
*/
@NotBlank(message = "审核人不能为空")
private String auditBy;
/**
*
*/
@NotNull(message = "审核时间不能为空")
private Date auditTime;
private Date updateTime;
private String createBy;
/**
*
*/
private Date createTime;
}

@ -0,0 +1,49 @@
package com.glxp.api.admin.req.purchase;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class PurPlanDetailRequest extends ListPageRequest {
/**
*
*/
@NotNull(message = "不能为空")
private Long id;
/**
*
*/
@NotBlank(message = "订单外键不能为空")
private String orderIdFk;
/**
* ID
*/
@NotNull(message = "产品ID不能为空")
private Long productId;
/**
*
*/
@NotBlank(message = "产品名称不能为空")
private String productName;
/**
*
*/
@NotNull(message = "数量不能为空")
private Long count;
/**
* ID
*/
@NotBlank(message = "供应商ID不能为空")
private String supId;
}

@ -0,0 +1,96 @@
package com.glxp.api.admin.req.purchase;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* pur pur_plan
*
* @author anthony.ywj
* @date 2022-10-12
*/
@Data
public class PurPlanRequest extends ListPageRequest {
/**
*
*/
@NotNull(message = "不能为空")
private Long id;
/**
*
*/
@NotBlank(message = "单据号不能为空")
private String billNo;
/**
*
*/
@NotNull(message = "单据日期不能为空")
private Date billDate;
/**
* 1.稿2.3.
*/
@NotNull(message = "状态1.草稿2.未审核3.已审核)不能为空")
private Long status;
/**
*
*/
@NotNull(message = "申购类型不能为空")
private Long billType;
/**
*
*/
@NotBlank(message = "申购说明不能为空")
private String remark;
/**
*
*/
@NotBlank(message = "当前仓库不能为空")
private String locStorageCode;
/**
*
*/
@NotBlank(message = "当前分库不能为空")
private String invWarehouseCode;
/**
*
*/
@NotBlank(message = "所属部门不能为空")
private String deptCode;
/**
*
*/
@NotBlank(message = "审核人不能为空")
private String auditBy;
/**
*
*/
@NotNull(message = "审核时间不能为空")
private Date auditTime;
private String createBy;
/**
*
*/
private Date createTime;
}

@ -0,0 +1,26 @@
package com.glxp.api.admin.service.purchase;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import java.util.List;
public interface IPurApplyDetailService {
List<PurApplyDetailEntity> queryPageList(PurApplyDetailRequest purApplyRequest);
List<StockOrderDetailEntity> joinQueryList(PurApplyDetailRequest purApplyRequest);
Boolean insert(PurApplyDetailEntity purApplyRequest);
Boolean update(PurApplyDetailEntity purApplyRequest);
Boolean deleteByIds(List<Long> ids);
Boolean deleteByOrderId(String orderIdfK);
}

@ -0,0 +1,17 @@
package com.glxp.api.admin.service.purchase;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.req.purchase.PurApplyRequest;
import java.util.List;
public interface IPurApplyService {
List<PurApplyEntity> queryPageList(PurApplyRequest purApplyRequest);
Integer insert(PurApplyEntity purApplyEntity);
Boolean update(PurApplyEntity purApplyRequest);
Boolean deleteByIds(List<Long> ids);
}

@ -0,0 +1,18 @@
package com.glxp.api.admin.service.purchase;
import com.glxp.api.admin.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.admin.req.purchase.PurPlanDetailRequest;
import java.util.List;
public interface IPurPlanDetailService {
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purPlanDetailRequest);
Boolean insert(PurPlanDetailRequest purPlanDetailRequest);
Boolean update(PurPlanDetailRequest purPlanDetailRequest);
Boolean deleteByIds(List<Long> ids);
}

@ -0,0 +1,21 @@
package com.glxp.api.admin.service.purchase;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurApplyRequest;
import com.glxp.api.admin.req.purchase.PurPlanRequest;
import java.util.List;
public interface IPurPlanService {
List<PurPlanEntity> queryPageList(PurPlanRequest purPlanRequest);
Boolean insert(PurPlanRequest purPlanRequest);
Boolean update(PurPlanRequest purPlanRequest);
Boolean deleteByIds(List<Long> ids);
}

@ -0,0 +1,69 @@
package com.glxp.api.admin.service.purchase.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.purchase.PurApplyDetailDao;
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
import com.glxp.api.admin.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurApplyDetailRequest;
import com.glxp.api.admin.service.purchase.IPurApplyDetailService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class PurApplyDetailImplService implements IPurApplyDetailService {
@Resource
PurApplyDetailDao purApplyDetailDao;
@Override
public List<PurApplyDetailEntity> queryPageList(PurApplyDetailRequest purApplyRequest) {
if (purApplyRequest == null) {
return Collections.emptyList();
}
if (purApplyRequest.getPage() != null) {
int offset = (purApplyRequest.getPage() - 1) * purApplyRequest.getLimit();
PageHelper.offsetPage(offset, purApplyRequest.getLimit());
}
List<PurApplyDetailEntity> data = purApplyDetailDao.queryPageList(purApplyRequest);
return data;
}
@Override
public List<StockOrderDetailEntity> joinQueryList(PurApplyDetailRequest purApplyRequest) {
if (purApplyRequest == null) {
return Collections.emptyList();
}
if (purApplyRequest.getPage() != null) {
int offset = (purApplyRequest.getPage() - 1) * purApplyRequest.getLimit();
PageHelper.offsetPage(offset, purApplyRequest.getLimit());
}
List<StockOrderDetailEntity> data = purApplyDetailDao.joinQueryList(purApplyRequest);
return data;
}
@Override
public Boolean insert(PurApplyDetailEntity purApplyRequest) {
return purApplyDetailDao.insert(purApplyRequest);
}
@Override
public Boolean update(PurApplyDetailEntity purApplyRequest) {
return purApplyDetailDao.update(purApplyRequest);
}
@Override
public Boolean deleteByIds(List<Long> ids) {
return purApplyDetailDao.deleteByIds(ids);
}
@Override
public Boolean deleteByOrderId(String orderIdfK) {
return purApplyDetailDao.deleteByOrderId(orderIdfK);
}
}

@ -0,0 +1,49 @@
package com.glxp.api.admin.service.purchase.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.purchase.PurApplyDao;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurApplyRequest;
import com.glxp.api.admin.service.purchase.IPurApplyService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class PurApplyServiceImpl implements IPurApplyService {
@Resource
PurApplyDao purApplyDao;
@Override
public List<PurApplyEntity> queryPageList(PurApplyRequest purApplyRequest) {
if (purApplyRequest == null) {
return Collections.emptyList();
}
if (purApplyRequest.getPage() != null) {
int offset = (purApplyRequest.getPage() - 1) * purApplyRequest.getLimit();
PageHelper.offsetPage(offset, purApplyRequest.getLimit());
}
List<PurApplyEntity> data = purApplyDao.queryPageList(purApplyRequest);
return data;
}
@Override
public Integer insert(PurApplyEntity purApplyEntity) {
return purApplyDao.insert(purApplyEntity);
}
@Override
public Boolean update(PurApplyEntity purApplyRequest) {
return purApplyDao.update(purApplyRequest);
}
@Override
public Boolean deleteByIds(List<Long> ids) {
return purApplyDao.deleteByIds(ids);
}
}

@ -0,0 +1,49 @@
package com.glxp.api.admin.service.purchase.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.purchase.PurPlanDao;
import com.glxp.api.admin.dao.purchase.PurPlanDetailDao;
import com.glxp.api.admin.entity.purchase.PurApplyEntity;
import com.glxp.api.admin.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.admin.req.purchase.PurPlanDetailRequest;
import com.glxp.api.admin.req.purchase.PurPlanRequest;
import com.glxp.api.admin.service.purchase.IPurPlanDetailService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
public class PurPlanDetailServiceImpl implements IPurPlanDetailService {
@Mapper
PurPlanDetailDao purPlanDetailDao;
@Override
public List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purPlanDetailRequest) {
if (purPlanDetailRequest == null) {
return Collections.emptyList();
}
if (purPlanDetailRequest.getPage() != null) {
int offset = (purPlanDetailRequest.getPage() - 1) * purPlanDetailRequest.getLimit();
PageHelper.offsetPage(offset, purPlanDetailRequest.getLimit());
}
List<PurPlanDetailEntity> data = purPlanDetailDao.queryPageList(purPlanDetailRequest);
return data;
}
@Override
public Boolean insert(PurPlanDetailRequest purPlanDetailRequest) {
return purPlanDetailDao.insert(purPlanDetailRequest);
}
@Override
public Boolean update(PurPlanDetailRequest purPlanDetailRequest) {
return purPlanDetailDao.update(purPlanDetailRequest);
}
@Override
public Boolean deleteByIds(List<Long> ids) {
return purPlanDetailDao.deleteByIds(ids);
}
}

@ -0,0 +1,47 @@
package com.glxp.api.admin.service.purchase.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.purchase.PurPlanDao;
import com.glxp.api.admin.entity.purchase.PurPlanEntity;
import com.glxp.api.admin.req.purchase.PurPlanRequest;
import com.glxp.api.admin.service.purchase.IPurPlanService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class PurPlanServiceImpl implements IPurPlanService {
@Resource
PurPlanDao purPlanDao;
@Override
public List<PurPlanEntity> queryPageList(PurPlanRequest purPlanRequest) {
if (purPlanRequest == null) {
return Collections.emptyList();
}
if (purPlanRequest.getPage() != null) {
int offset = (purPlanRequest.getPage() - 1) * purPlanRequest.getLimit();
PageHelper.offsetPage(offset, purPlanRequest.getLimit());
}
List<PurPlanEntity> data = purPlanDao.queryPageList(purPlanRequest);
return data;
}
@Override
public Boolean insert(PurPlanRequest purPlanRequest) {
return purPlanDao.insert(purPlanRequest);
}
@Override
public Boolean update(PurPlanRequest purPlanRequest) {
return purPlanDao.update(purPlanRequest);
}
@Override
public Boolean deleteByIds(List<Long> ids) {
return purPlanDao.deleteByIds(ids);
}
}

@ -151,6 +151,26 @@ public class GennerOrderUtils {
}
public String createPurOrderNo(OrderNoTypeBean orderNoTypeEnum) {
//获得单号前缀
//格式 固定前缀 +时间前缀 示例
String formNoPrefix = getFormNoPrefix(orderNoTypeEnum);
//获得缓存key
String cacheKey = getStCacheKey(formNoPrefix);
//获得当日自增数
Long incrementalSerial = redisUtil.incr(cacheKey, 1);
// 设置key过期时间, 保证每天的流水号从1开始
if (incrementalSerial == 1) {
//设置失效时间 凌晨过期
redisUtil.expire(cacheKey, getSecondsNextEarlyMorning());
}
//组合单号并补全流水号
String serialWithPrefix = completionSerial(formNoPrefix, incrementalSerial, orderNoTypeEnum);
//补全随机数
return completionRandom(serialWithPrefix, orderNoTypeEnum);
}
private Long getSecondsNextEarlyMorning() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, 1);

@ -1,6 +1,6 @@
server.port=9991
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.jdbc-url=jdbc:mysql://192.168.0.109:3306/udiwms_ph1?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.jdbc-url=jdbc:mysql://192.168.1.18:3306/udiwms_ph1?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.hikari.connection-timeout=60000

@ -38,7 +38,7 @@
basic_udirel.ybbm,basic_udirel.sptm,
basic_udirel.manufactory,basic_udirel.measname,basic_udirel.lockStatus,basic_products.allowNoBatch,
basic_products.allowNoExpire,
basic_products.allowNoProduct,,basic_products.productType,
basic_products.allowNoProduct,basic_products.productType,
basic_products.nameCode,basic_products.packRatio,basic_products.packLevel,basic_products.bhxjsl,
basic_products.bhzxxsbzsl,basic_products.zxxsbzbhsydysl,basic_products.bhxjcpbm,
basic_products.bzcj,basic_products.addType,basic_udirel.isDisable,
@ -56,7 +56,6 @@
,basic_products.basicPrductRemak1
,basic_products.basicPrductRemak2,basic_products.basicPrductRemak3,basic_products.basicPrductRemak4,basic_products.basicPrductRemak5,basic_products.basicPrductRemak6
,basic_products.basicPrductRemak7,basic_products.basicPrductRemak8
FROM company_product_relevance
inner JOIN basic_udirel
ON company_product_relevance.udiRlIdFk = basic_udirel.id

@ -0,0 +1,96 @@
<?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.admin.dao.purchase.PurApplyDao">
<select id="queryPageList" parameterType="com.glxp.api.admin.req.purchase.PurApplyRequest"
resultType="com.glxp.api.admin.entity.purchase.PurApplyEntity">
select *
FROM pur_apply
<where>
<if test="billNo != '' and billNo != null">
AND billNo = #{billNo}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="deptCode != '' and deptCode != null">
AND deptCode = #{deptCode}
</if>
<if test="locStorageCode != '' and locStorageCode != null">
AND locStorageCode = #{locStorageCode}
</if>
<if test="invWarehouseCode != '' and invWarehouseCode != null">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="auditBy != '' and auditBy != null">
AND auditBy = #{auditBy}
</if>
<if test="createBy != '' and createBy != null">
AND createBy = #{createBy}
</if>
</where>
</select>
<insert id="insert" keyProperty="id"
parameterType="com.glxp.api.admin.entity.purchase.PurApplyEntity" useGeneratedKeys="true">
replace
INTO pur_apply
(
billNo,billDate,status,billType,remark,locStorageCode,invWarehouseCode,
deptCode,createBy,createTime,auditBy,auditTime,updateTime
)
values (
#{billNo},
#{billDate},
#{status},
#{billType},
#{remark},
#{locStorageCode},
#{invWarehouseCode},
#{deptCode},
#{createBy},
#{createTime},
#{auditBy},
#{auditTime},#{updateTime}
)
</insert>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE FROM pur_apply WHERE id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteById" parameterType="Map">
DELETE
FROM pur_apply
WHERE id = #{id}
</delete>
<update id="update" parameterType="com.glxp.api.admin.entity.purchase.PurApplyEntity">
UPDATE pur_apply
<trim prefix="set" suffixOverrides=",">
<if test="billNo != null">billNo=#{billNo},</if>
<if test="billDate != null">billDate=#{billDate},</if>
<if test="status != null">status=#{status},</if>
<if test="billType != null">billType=#{billType},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
<if test="deptCode != null">deptCode=#{deptCode},</if>
<if test="auditBy != null">auditBy=#{auditBy},</if>
<if test="auditTime != null">auditTime=#{auditTime},</if>
<if test="createBy != null">createBy=#{createBy},</if>
<if test="createTime != null">createTime=#{createTime},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -0,0 +1,96 @@
<?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.admin.dao.purchase.PurApplyDetailDao">
<select id="queryPageList" parameterType="com.glxp.api.admin.req.purchase.PurApplyDetailRequest"
resultType="com.glxp.api.admin.entity.purchase.PurApplyEntity">
select *
FROM pur_apply_detail
<where>
<if test="orderIdFk != '' and orderIdFk != null">
AND orderIdFk = #{orderIdFk}
</if>
<if test="productId != null">
AND productId = #{productId}
</if>
<if test="supId != '' and supId != null">
AND supId = #{supId}
</if>
</where>
</select>
<select id="joinQueryList" parameterType="com.glxp.api.admin.req.purchase.PurApplyDetailRequest"
resultType="com.glxp.api.admin.entity.business.StockOrderDetailEntity">
select
pur_apply_detail.*,
basic_products.ggxh spec,basic_udirel.measname,basic_udirel.manufactory
FROM pur_apply_detail
INNER JOIN basic_udirel on pur_apply_detail.productId = basic_udirel.id
INNER JOIN basic_products on basic_udirel.uuid = basic_products.uuid
<where>
<if test="orderIdFk != '' and orderIdFk != null">
AND orderIdFk = #{orderIdFk}
</if>
<if test="productId != null">
AND productId = #{productId}
</if>
<if test="supId != '' and supId != null">
AND supId = #{supId}
</if>
</where>
</select>
<insert id="insert" keyProperty="id"
parameterType="com.glxp.api.admin.entity.purchase.PurApplyDetailEntity">
replace
INTO pur_apply_detail
(
orderIdFk,productId,productName,`count`,supId
)
values (
#{orderIdFk},
#{productId},
#{productName},
#{count},
#{supId}
)
</insert>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE FROM pur_apply_detail WHERE id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteById" parameterType="Map">
DELETE
FROM pur_apply_detail
WHERE id = #{id}
</delete>
<delete id="deleteByOrderId" parameterType="Map">
DELETE
FROM pur_apply_detail
WHERE orderIdFk = #{orderIdFk}
</delete>
<update id="update" parameterType="com.glxp.api.admin.entity.purchase.PurApplyDetailEntity">
UPDATE pur_apply_detail
<trim prefix="set" suffixOverrides=",">
<if test="orderIdFk != null">orderIdFk=#{orderIdFk},</if>
<if test="productId != null">productId=#{productId},</if>
<if test="productName != null">productName=#{productName},</if>
<if test="count != null">`count`=#{count},</if>
<if test="supId != null">supId=#{supId},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -0,0 +1,94 @@
<?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.admin.dao.purchase.PurPlanDao">
<select id="queryPageList" parameterType="com.glxp.api.admin.req.purchase.PurPlanRequest"
resultType="com.glxp.api.admin.entity.purchase.PurPlanEntity">
select *
FROM pur_plan
<where>
<if test="billNo != '' and billNo != null">
AND billNo = #{billNo}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="deptCode != '' and deptCode != null">
AND deptCode = #{deptCode}
</if>
<if test="locStorageCode != '' and locStorageCode != null">
AND locStorageCode = #{locStorageCode}
</if>
<if test="invWarehouseCode != '' and invWarehouseCode != null">
AND invWarehouseCode = #{invWarehouseCode}
</if>
<if test="auditBy != '' and auditBy != null">
AND auditBy = #{auditBy}
</if>
<if test="createBy != '' and createBy != null">
AND createBy = #{createBy}
</if>
</where>
</select>
<insert id="insert" keyProperty="id"
parameterType="com.glxp.api.admin.req.purchase.PurPlanRequest">
replace
INTO pur_plan
(
billNo,billDate,status,billType,remark,locStorageCode,invWarehouseCode,
deptCode,createBy,createTime,auditBy,auditTime
)
values (
#{billNo},
#{billDate},
#{status},
#{billType},
#{remark},
#{locStorageCode},
#{invWarehouseCode},
#{deptCode},
#{createBy},
#{createTime},
#{auditBy},
#{auditTime}
)
</insert>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE FROM pur_plan WHERE id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteById" parameterType="Map">
DELETE
FROM pur_plan
WHERE id = #{id}
</delete>
<update id="update" parameterType="com.glxp.api.admin.req.purchase.PurPlanRequest">
UPDATE pur_plan
<trim prefix="set" suffixOverrides=",">
<if test="billNo != null">billNo=#{billNo},</if>
<if test="billDate != null">billDate=#{billDate},</if>
<if test="status != null">status=#{status},</if>
<if test="billType != null">billType=#{billType},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
<if test="deptCode != null">deptCode=#{deptCode},</if>
<if test="auditBy != null">auditBy=#{auditBy},</if>
<if test="auditTime != null">auditTime=#{auditTime},</if>
<if test="createBy != null">createBy=#{createBy},</if>
<if test="createTime != null">createTime=#{createTime},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>

@ -0,0 +1,67 @@
<?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.admin.dao.purchase.PurPlanDetailDao">
<select id="queryPageList" parameterType="com.glxp.api.admin.req.purchase.PurPlanDetailRequest"
resultType="com.glxp.api.admin.entity.purchase.PurPlanDetailEntity">
select *
FROM pur_plan_detail
<where>
<if test="orderIdFk != '' and orderIdFk != null">
AND orderIdFk = #{orderIdFk}
</if>
<if test="productId != null">
AND productId = #{productId}
</if>
<if test="supId != '' and supId != null">
AND supId = #{supId}
</if>
</where>
</select>
<insert id="insert" keyProperty="id"
parameterType="com.glxp.api.admin.req.purchase.PurPlanDetailRequest">
replace
INTO pur_plan_detail
(
orderIdFk,productId,productName,`count`,supId
)
values (
#{orderIdFk},
#{productId},
#{productName},
#{count},
#{supId}
)
</insert>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE FROM pur_plan_detail WHERE id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<delete id="deleteById" parameterType="Map">
DELETE
FROM pur_plan_detail
WHERE id = #{id}
</delete>
<update id="update" parameterType="com.glxp.api.admin.req.purchase.PurPlanDetailRequest">
UPDATE pur_plan_detail
<trim prefix="set" suffixOverrides=",">
<if test="orderIdFk != null">orderIdFk=#{orderIdFk},</if>
<if test="productId != null">productId=#{productId},</if>
<if test="productName != null">productName=#{productName},</if>
<if test="count != null">`count`=#{count},</if>
<if test="supId != null">supId=#{supId},</if>
</trim>
WHERE id = #{id}
</update>
</mapper>
Loading…
Cancel
Save