申购代码提交
parent
56cc217a14
commit
a7873d3831
@ -0,0 +1,329 @@
|
|||||||
|
package com.glxp.api.controller.purchase;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||||
|
import com.glxp.api.annotation.RepeatSubmit;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.constant.Constant;
|
||||||
|
import com.glxp.api.constant.ConstantStatus;
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import com.glxp.api.req.purchase.PostPurApplyRequest;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyDetailRequest;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.purchase.PurApplyResponse;
|
||||||
|
import com.glxp.api.res.purchase.PurOrderDetailResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.basic.IBasicBussinessTypeService;
|
||||||
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
||||||
|
import com.glxp.api.service.basic.UdiRlSupService;
|
||||||
|
import com.glxp.api.service.purchase.PurApplyDetailService;
|
||||||
|
import com.glxp.api.service.purchase.PurApplyService;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanService;
|
||||||
|
import com.glxp.api.util.GennerOrderUtils;
|
||||||
|
import com.glxp.api.util.OrderNoTypeBean;
|
||||||
|
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
|
||||||
|
public class PurApplyController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PurApplyService purApplyService;
|
||||||
|
@Resource
|
||||||
|
PurApplyDetailService purApplyDetailService;
|
||||||
|
@Resource
|
||||||
|
PurPlanService purPlanService;
|
||||||
|
@Resource
|
||||||
|
PurPlanDetailService purPlanDetailService;
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CustomerService customerService;
|
||||||
|
@Resource
|
||||||
|
GennerOrderUtils gennerOrderUtils;
|
||||||
|
@Resource
|
||||||
|
UdiRelevanceService udiRelevanceService;
|
||||||
|
@Resource
|
||||||
|
UdiRlSupService udiRlSupService;
|
||||||
|
@Resource
|
||||||
|
IBasicBussinessTypeService basicBussinessTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/purchase/apply/postOrder")
|
||||||
|
public BaseResponse postOrder(@RequestBody PostPurApplyRequest postPurApplyRequest) {
|
||||||
|
|
||||||
|
Long userId = customerService.getUserId();
|
||||||
|
PurApplyEntity purApplyEntity = postPurApplyRequest.getPurApplyEntity();
|
||||||
|
purApplyEntity.setCreateUser(userId + "");
|
||||||
|
purApplyEntity.setCreateTime(new Date());
|
||||||
|
purApplyEntity.setUpdateTime(new Date());
|
||||||
|
purApplyEntity.setStatus(postPurApplyRequest.getEditStatus()); //草稿状态
|
||||||
|
if(postPurApplyRequest.getType()!=null){
|
||||||
|
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
|
||||||
|
purApplyEntity.setBillNo(billNo);
|
||||||
|
}
|
||||||
|
if (purApplyEntity.getId() == null) {
|
||||||
|
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.setCount(stockOrderDetailEntity.getCount());
|
||||||
|
// purApplyDetailEntity.setOrderIdFk(purApplyEntity.getId() + "");
|
||||||
|
// purApplyDetailService.insert(purApplyDetailEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return ResultVOUtils.success("提交成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询申购单列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/purchase/apply/list")
|
||||||
|
public BaseResponse list(PurApplyRequest purApplyRequest) {
|
||||||
|
|
||||||
|
if (purApplyRequest.getStatus() == null) {
|
||||||
|
purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PurApplyResponse> purApplyEntities = purApplyService.queryPageList(purApplyRequest);
|
||||||
|
PageInfo<PurApplyResponse> pageInfo;
|
||||||
|
pageInfo = new PageInfo<>(purApplyEntities);
|
||||||
|
PageSimpleResponse<PurApplyResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(purApplyEntities);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询申购单列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/purchase/apply/auditList")
|
||||||
|
public BaseResponse auditList(PurApplyRequest purApplyRequest) {
|
||||||
|
|
||||||
|
if (purApplyRequest.getStatus() == null) {
|
||||||
|
purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PurApplyResponse> purApplyEntities = purApplyService.queryPageList(purApplyRequest);
|
||||||
|
PageInfo<PurApplyResponse> pageInfo;
|
||||||
|
pageInfo = new PageInfo<>(purApplyEntities);
|
||||||
|
PageSimpleResponse<PurApplyResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(purApplyEntities);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/purchase/apply/auditOrder")
|
||||||
|
public BaseResponse auditOrder(@RequestBody PurApplyResponse purApplyRequest) {
|
||||||
|
|
||||||
|
|
||||||
|
Long userId = customerService.getUserId();
|
||||||
|
PurApplyEntity purApplyEntity = new PurApplyEntity();
|
||||||
|
BeanUtils.copyProperties(purApplyRequest, purApplyEntity);
|
||||||
|
purApplyEntity.setUpdateTime(new Date());
|
||||||
|
purApplyEntity.setAuditTime(new Date());
|
||||||
|
purApplyEntity.setAuditUser(userId + "");
|
||||||
|
purApplyService.update(purApplyEntity);
|
||||||
|
|
||||||
|
//审核通过后转换成采购计划单
|
||||||
|
if (purApplyEntity.getStatus() == ConstantStatus.APPLY_AUDIT_ED && purApplyRequest.isAudtoPlan()) {
|
||||||
|
PurPlanEntity purPlanEntity = new PurPlanEntity();
|
||||||
|
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd"));
|
||||||
|
purPlanEntity.setBillNo(billNo);
|
||||||
|
purPlanEntity.setBillDate(new Date());
|
||||||
|
purPlanEntity.setStatus(ConstantStatus.APPLY_DRAFT);
|
||||||
|
purPlanEntity.setBillType("purPlan");
|
||||||
|
purPlanEntity.setCreateTime(new Date());
|
||||||
|
purPlanEntity.setUpdateTime(new Date());
|
||||||
|
purPlanEntity.setApplyBillNo(purApplyEntity.getBillNo());
|
||||||
|
purPlanEntity.setApplyCreateBy(purApplyEntity.getCreateUser());
|
||||||
|
purPlanEntity.setApplyRemark(purApplyEntity.getRemark());
|
||||||
|
purPlanEntity.setApplyAuditBy(purApplyEntity.getAuditUser());
|
||||||
|
purPlanEntity.setRemark("申购科室:" + purApplyRequest.getTargetInvCode() +
|
||||||
|
";申购人:" + purApplyRequest.getCreateByName() + ";申购原因:" + purApplyRequest.getRemark());
|
||||||
|
purApplyEntity.setPlanBillNo(purPlanEntity.getBillNo());
|
||||||
|
purApplyEntity.setGeneratePlan(true);
|
||||||
|
purApplyService.update(purApplyEntity);
|
||||||
|
purPlanService.insert(purPlanEntity);
|
||||||
|
List<PurApplyDetailEntity> purApplyDetailEntities = purApplyDetailService.findByOrderId(purApplyEntity.getId() + "");
|
||||||
|
if (CollUtil.isNotEmpty(purApplyDetailEntities)) {
|
||||||
|
for (PurApplyDetailEntity purApplyDetailEntity : purApplyDetailEntities) {
|
||||||
|
PurPlanDetailEntity purPlanDetailEntity = new PurPlanDetailEntity();
|
||||||
|
BeanUtils.copyProperties(purApplyDetailEntity, purPlanDetailEntity);
|
||||||
|
purPlanDetailEntity.setOrderIdFk(purPlanEntity.getId() + "");
|
||||||
|
purPlanDetailService.insert(purPlanDetailEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResultVOUtils.success("更新成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/purchase/apply")
|
||||||
|
public BaseResponse add(@RequestBody PurApplyEntity purApplyRequest) {
|
||||||
|
|
||||||
|
purApplyService.insert(purApplyRequest);
|
||||||
|
return ResultVOUtils.success("新增成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping("/purchase/apply")
|
||||||
|
public BaseResponse edit(@RequestBody PurApplyEntity purApplyRequest) {
|
||||||
|
purApplyService.update(purApplyRequest);
|
||||||
|
return ResultVOUtils.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申购单
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/purchase/apply/{ids}")
|
||||||
|
public BaseResponse remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
List<Long> idArray = Arrays.asList(ids);
|
||||||
|
if (CollUtil.isNotEmpty(idArray)) {
|
||||||
|
purApplyService.deleteByIds(idArray);
|
||||||
|
for (Long id : idArray) {
|
||||||
|
purApplyDetailService.deleteByOrderId(id + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ResultVOUtils.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询申购单列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/purchase/apply/list/detail")
|
||||||
|
public BaseResponse detailList(PurApplyDetailRequest purApplyDetailRequest) {
|
||||||
|
|
||||||
|
List<PurOrderDetailResponse> purApplyDetailEntities = purApplyDetailService.joinQueryList(purApplyDetailRequest);
|
||||||
|
PageInfo<PurOrderDetailResponse> pageInfo;
|
||||||
|
pageInfo = new PageInfo<>(purApplyDetailEntities);
|
||||||
|
PageSimpleResponse<PurOrderDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
pageSimpleResponse.setList(purApplyDetailEntities);
|
||||||
|
return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/purchase/apply/detail")
|
||||||
|
public BaseResponse detailAdd(@RequestBody PurApplyDetailEntity purApplyDetailEntity) {
|
||||||
|
|
||||||
|
purApplyDetailService.insert(purApplyDetailEntity);
|
||||||
|
return ResultVOUtils.success("新增成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/purchase/apply/updateDetail")
|
||||||
|
public BaseResponse detailEdit(@RequestBody PurApplyDetailEntity purApplyDetailRequest) {
|
||||||
|
purApplyDetailService.update(purApplyDetailRequest);
|
||||||
|
return ResultVOUtils.success("修改成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除申购单
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/purchase/apply/detail/{ids}")
|
||||||
|
public BaseResponse detailRemove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
|
||||||
|
purApplyDetailService.deleteByIds(Arrays.asList(ids));
|
||||||
|
return ResultVOUtils.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*** 插入申购单详情 */
|
||||||
|
/**
|
||||||
|
* 新增申购单
|
||||||
|
*/
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping("/purchase/apply/addDetail")
|
||||||
|
public BaseResponse addDetail(@RequestBody PurApplyDetailEntity purApplyDetailEntity) {
|
||||||
|
|
||||||
|
purApplyDetailService.insert(purApplyDetailEntity);
|
||||||
|
return ResultVOUtils.success(purApplyDetailEntity.getOrderIdFk());
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增申购单
|
||||||
|
*/
|
||||||
|
@AuthRuleAnnotation("")
|
||||||
|
@PostMapping("/purchase/apply/add")
|
||||||
|
public BaseResponse add() {
|
||||||
|
|
||||||
|
Long userId = customerService.getUserId();
|
||||||
|
PurApplyEntity purApplyEntity = new PurApplyEntity();
|
||||||
|
purApplyEntity.setCreateUser(userId + "");
|
||||||
|
purApplyEntity.setCreateTime(new Date());
|
||||||
|
purApplyEntity.setUpdateTime(new Date());
|
||||||
|
purApplyEntity.setUpdateUser(userId + "");
|
||||||
|
purApplyService.insert(purApplyEntity);
|
||||||
|
Long id=purApplyEntity.getId();
|
||||||
|
return ResultVOUtils.success(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,337 @@
|
|||||||
|
package com.glxp.api.controller.purchase;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||||
|
import com.glxp.api.annotation.RepeatSubmit;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.constant.Constant;
|
||||||
|
import com.glxp.api.constant.ConstantStatus;
|
||||||
|
import com.glxp.api.entity.basic.BasicCorpEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import com.glxp.api.req.purchase.PostPurPlanRequest;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
||||||
|
import com.glxp.api.res.PageSimpleResponse;
|
||||||
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
||||||
|
import com.glxp.api.res.purchase.PurPlanResponse;
|
||||||
|
import com.glxp.api.service.auth.CustomerService;
|
||||||
|
import com.glxp.api.service.basic.BasicCorpService;
|
||||||
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanService;
|
||||||
|
import com.glxp.api.util.GennerOrderUtils;
|
||||||
|
import com.glxp.api.util.OrderNoTypeBean;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pur
|
||||||
|
*
|
||||||
|
* @author anthony.ywj
|
||||||
|
* @date 2022-10-12
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
public class PurPlanController {
|
||||||
|
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// PurPlanService purPlanService;
|
||||||
|
// @Resource
|
||||||
|
// PurPlanDetailService purPlanDetailService;
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// CustomerService customerService;
|
||||||
|
// @Resource
|
||||||
|
// GennerOrderUtils gennerOrderUtils;
|
||||||
|
// @Resource
|
||||||
|
// BasicCorpService basicCorpService;
|
||||||
|
// @Resource
|
||||||
|
// UdiRelevanceService udiRelevanceService;
|
||||||
|
// @Resource
|
||||||
|
// StockOrderDetailService stockOrderDetailService;
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// StockOrderService stockOrderService;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @AuthRuleAnnotation("")
|
||||||
|
// @PostMapping("/purchase/plan/postOrder")
|
||||||
|
// public BaseResponse postOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
||||||
|
//
|
||||||
|
// Long userId = customerService.getUserId();
|
||||||
|
// PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
||||||
|
//
|
||||||
|
// purApplyEntity.setCreateUser(userId + "");
|
||||||
|
// purApplyEntity.setCreateTime(new Date());
|
||||||
|
// purApplyEntity.setUpdateTime(new Date());
|
||||||
|
// purApplyEntity.setStatus(postPurPlanRequest.getEditStatus()); //草稿状态
|
||||||
|
// if (purApplyEntity.getId() == null) {
|
||||||
|
// String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd"));
|
||||||
|
// purApplyEntity.setBillNo(billNo);
|
||||||
|
// purPlanService.insert(purApplyEntity);
|
||||||
|
// } else {
|
||||||
|
// purPlanService.update(purApplyEntity);
|
||||||
|
// if (CollUtil.isNotEmpty(postPurPlanRequest.getSubErpOrders())) {
|
||||||
|
// purPlanDetailService.deleteByOrderId(purApplyEntity.getId() + "");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// List<PurPlanDetailEntity> purPlanDetailEntities = new ArrayList<>();
|
||||||
|
// if (CollUtil.isNotEmpty(postPurPlanRequest.getSubErpOrders())) {
|
||||||
|
// for (StockOrderDetailEntity stockOrderDetailEntity : postPurPlanRequest.getSubErpOrders()) {
|
||||||
|
// PurPlanDetailEntity purApplyDetailEntity = new PurPlanDetailEntity();
|
||||||
|
// BeanUtils.copyProperties(stockOrderDetailEntity, purApplyDetailEntity);
|
||||||
|
// purApplyDetailEntity.setOrderIdFk(purApplyEntity.getId() + "");
|
||||||
|
// purApplyDetailEntity.setCount(Integer.valueOf(stockOrderDetailEntity.getCount()));
|
||||||
|
// purPlanDetailService.insert(purApplyDetailEntity);
|
||||||
|
// purPlanDetailEntities.add(purApplyDetailEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return ResultVOUtils.success("提交成功!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询采购计划列表
|
||||||
|
// */
|
||||||
|
// @GetMapping("/purchase/plan/list")
|
||||||
|
// public BaseResponse list(PurPlanRequest purApplyRequest) {
|
||||||
|
//
|
||||||
|
// if (purApplyRequest.getStatus() == null) {
|
||||||
|
// purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
||||||
|
// PageInfo<PurPlanResponse> pageInfo;
|
||||||
|
// pageInfo = new PageInfo<>(purApplyEntities);
|
||||||
|
// PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
// pageSimpleResponse.setList(purApplyEntities);
|
||||||
|
// return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询采购计划列表
|
||||||
|
// */
|
||||||
|
// @GetMapping("/purchase/plan/auditList")
|
||||||
|
// public BaseResponse auditList(PurPlanRequest purApplyRequest) {
|
||||||
|
//
|
||||||
|
// if (purApplyRequest.getStatus() == null) {
|
||||||
|
// purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
||||||
|
// }
|
||||||
|
// List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
||||||
|
// PageInfo<PurPlanResponse> pageInfo;
|
||||||
|
// pageInfo = new PageInfo<>(purApplyEntities);
|
||||||
|
// PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
||||||
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||||
|
// pageSimpleResponse.setList(purApplyEntities);
|
||||||
|
// return ResultVOUtils.success(pageSimpleResponse);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 审核采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @PostMapping("/purchase/plan/auditOrder")
|
||||||
|
// public BaseResponse auditOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
||||||
|
// Long userId = customerService.getUserId();
|
||||||
|
// PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
||||||
|
// purApplyEntity.setUpdateTime(new Date());
|
||||||
|
// purApplyEntity.setAuditUser(userId + "");
|
||||||
|
// purApplyEntity.setStatus(postPurPlanRequest.getEditStatus());
|
||||||
|
// purPlanService.update(purApplyEntity);
|
||||||
|
//
|
||||||
|
// List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + "");
|
||||||
|
//
|
||||||
|
//// BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.findByAction(purApplyEntity.getBillType());
|
||||||
|
// //转换成业务单据
|
||||||
|
// if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED
|
||||||
|
// && StrUtil.isNotEmpty(purApplyEntity.getTargetSubInv()) && StrUtil.isNotEmpty(purApplyEntity.getTargetBillAction())) {
|
||||||
|
//
|
||||||
|
// if (CollUtil.isNotEmpty(purPlanDetailEntities)) {
|
||||||
|
// //1.根据供应商分组
|
||||||
|
// Map<String, List<PurPlanDetailEntity>> filterSupMaps = new HashMap<>();
|
||||||
|
// for (PurPlanDetailEntity purPlanDetailEntity : purPlanDetailEntities) {
|
||||||
|
// if (StrUtil.isNotEmpty(purPlanDetailEntity.getSupId())) {
|
||||||
|
// if (filterSupMaps.get(purPlanDetailEntity.getSupId()) == null) {
|
||||||
|
// List<PurPlanDetailEntity> temps = new ArrayList<>();
|
||||||
|
// temps.add(purPlanDetailEntity);
|
||||||
|
// filterSupMaps.put(purPlanDetailEntity.getSupId(), temps);
|
||||||
|
// } else {
|
||||||
|
// filterSupMaps.get(purPlanDetailEntity.getSupId()).add(purPlanDetailEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //2.生成业务单据
|
||||||
|
// String stockOrderNo = ";";
|
||||||
|
// for (String supId : filterSupMaps.keySet()) {
|
||||||
|
// //2.构建业务单据
|
||||||
|
// StockOrderEntity stockOrderEntity = new StockOrderEntity();
|
||||||
|
// String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.BUS_ORDER, "yyyyMMdd"));
|
||||||
|
// stockOrderNo = stockOrderNo + billNo;
|
||||||
|
// stockOrderEntity.setBillNo(billNo);
|
||||||
|
// stockOrderEntity.setSourceType(ConstantStatus.ST_APPLY_ADD);
|
||||||
|
// stockOrderEntity.setCorpId(supId);
|
||||||
|
// stockOrderEntity.setUnitIdFk(supId);
|
||||||
|
// BasicCorpEntity basicCorpEntity = basicCorpService.selectByErpId(supId);
|
||||||
|
// stockOrderEntity.setCorpName(basicCorpEntity.getName());
|
||||||
|
// stockOrderEntity.setBilldate(DateUtil.formatDateTime(new Date()));
|
||||||
|
// stockOrderEntity.setStatus(ConstantStatus.SORDER_ALLOC);
|
||||||
|
// stockOrderEntity.setBillType(purApplyEntity.getTargetBillAction());
|
||||||
|
// stockOrderEntity.setInvWarehouseCode(purApplyEntity.getTargetSubInv());
|
||||||
|
// stockOrderEntity.setLocStorageCode(purApplyEntity.getTargetInv());
|
||||||
|
// stockOrderEntity.setCreateUser(userId);
|
||||||
|
//// stockOrderEntity.setDept(purApplyEntity.getDeptCode());
|
||||||
|
// stockOrderService.insertStockOrder(stockOrderEntity);
|
||||||
|
// //3.构建单据详情
|
||||||
|
// List<PurPlanDetailEntity> temps = filterSupMaps.get(supId);
|
||||||
|
// if (CollUtil.isNotEmpty(temps)) {
|
||||||
|
// List<StockOrderDetailEntity> stockOrderDetailEntities = new ArrayList<>();
|
||||||
|
// for (PurPlanDetailEntity purPlanDetailEntity : temps) {
|
||||||
|
// StockOrderDetailEntity stockOrderDetailEntity = new StockOrderDetailEntity();
|
||||||
|
// UdiRelevanceResponse udiRelevanceEntity = udiRelevanceService.selectGroupById(purPlanDetailEntity.getProductId());
|
||||||
|
// stockOrderDetailEntity.setProductName(udiRelevanceEntity.getCpmctymc());
|
||||||
|
// stockOrderDetailEntity.setRelId(udiRelevanceEntity.getId() + "");
|
||||||
|
// stockOrderDetailEntity.setProductId(udiRelevanceEntity.getId() + "");
|
||||||
|
// stockOrderDetailEntity.setSpec(udiRelevanceEntity.getGgxh());
|
||||||
|
// stockOrderDetailEntity.setCount(purPlanDetailEntity.getCount());
|
||||||
|
// stockOrderDetailEntity.setReCount(purPlanDetailEntity.getCount());
|
||||||
|
// stockOrderDetailEntity.setManufactory(udiRelevanceEntity.getManufactory());
|
||||||
|
// stockOrderDetailEntity.setYlqxzcrbarmc(udiRelevanceEntity.getYlqxzcrbarmc());
|
||||||
|
// stockOrderDetailEntity.setZczbhhzbapzbh(udiRelevanceEntity.getZczbhhzbapzbh());
|
||||||
|
// stockOrderDetailEntity.setMeasname(udiRelevanceEntity.getMeasname());
|
||||||
|
// stockOrderDetailEntity.setOrderIdFk(stockOrderEntity.getId());
|
||||||
|
// stockOrderDetailEntities.add(stockOrderDetailEntity);
|
||||||
|
// }
|
||||||
|
// if (CollUtil.isNotEmpty(stockOrderDetailEntities)) {
|
||||||
|
// stockOrderDetailService.insertStockOrderDetails(stockOrderDetailEntities);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// purApplyEntity.setStockOrderNo(stockOrderNo.substring(1));
|
||||||
|
// purPlanService.update(purApplyEntity);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return ResultVOUtils.success("更新成功!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @PostMapping("/purchase/plan")
|
||||||
|
// public BaseResponse add(@RequestBody PurPlanEntity purApplyRequest) {
|
||||||
|
//
|
||||||
|
// purPlanService.insert(purApplyRequest);
|
||||||
|
// return ResultVOUtils.success("新增成功!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @PutMapping("/purchase/plan")
|
||||||
|
// public BaseResponse edit(@RequestBody PurPlanEntity purApplyRequest) {
|
||||||
|
// purPlanService.update(purApplyRequest);
|
||||||
|
// return ResultVOUtils.success("删除成功");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// /**
|
||||||
|
//// * 查询采购计划列表
|
||||||
|
//// */
|
||||||
|
//// @GetMapping("/purchase/plan/list/detail")
|
||||||
|
//// public BaseResponse detailList(PurPlanDetailRequest purApplyDetailRequest) {
|
||||||
|
////
|
||||||
|
//// List<StockOrderDetailEntity> purApplyDetailEntities = purPlanDetailService.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);
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除采购计划
|
||||||
|
// *
|
||||||
|
// * @param ids 主键串
|
||||||
|
// */
|
||||||
|
// @DeleteMapping("/purchase/plan/{ids}")
|
||||||
|
// public BaseResponse remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
// @PathVariable Integer[] ids) {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// List<Integer> idArray = Arrays.asList(ids);
|
||||||
|
// if (CollUtil.isNotEmpty(idArray)) {
|
||||||
|
// purPlanService.deleteByIds(idArray);
|
||||||
|
// for (Integer id : idArray) {
|
||||||
|
// purPlanDetailService.deleteByOrderId(id + "");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return ResultVOUtils.success("删除成功");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @PostMapping("/purchase/plan/detail")
|
||||||
|
// public BaseResponse detailAdd(@RequestBody PurPlanDetailEntity purPlanDetailRequest) {
|
||||||
|
//
|
||||||
|
// purPlanDetailService.insert(purPlanDetailRequest);
|
||||||
|
// return ResultVOUtils.success("新增成功");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改采购计划
|
||||||
|
// */
|
||||||
|
// @RepeatSubmit()
|
||||||
|
// @PutMapping("/purchase/plan/detail")
|
||||||
|
// public BaseResponse detailEdit(@RequestBody PurPlanDetailEntity purPlanDetailRequest) {
|
||||||
|
// purPlanDetailService.update(purPlanDetailRequest);
|
||||||
|
// return ResultVOUtils.success("修改成功");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除采购计划
|
||||||
|
// *
|
||||||
|
// * @param ids 主键串
|
||||||
|
// */
|
||||||
|
// @DeleteMapping("/purchase/plan/detail/{ids}")
|
||||||
|
// public BaseResponse detailRemove(@NotEmpty(message = "主键不能为空")
|
||||||
|
// @PathVariable Long[] ids) {
|
||||||
|
//
|
||||||
|
// purPlanDetailService.deleteByIds(Arrays.asList(ids));
|
||||||
|
// return ResultVOUtils.success("删除成功");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.glxp.api.dao.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurApplyResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PurApplyDao {
|
||||||
|
|
||||||
|
List<PurApplyResponse> queryPageList(PurApplyRequest purApplyRequest);
|
||||||
|
|
||||||
|
Integer insert(PurApplyEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean update(PurApplyEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.glxp.api.dao.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyDetailRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurOrderDetailResponse;
|
||||||
|
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<PurOrderDetailResponse> joinQueryList(PurApplyDetailRequest purApplyRequest);
|
||||||
|
|
||||||
|
Boolean insert(PurApplyDetailEntity purApplyDetailEntity);
|
||||||
|
|
||||||
|
Boolean update(PurApplyDetailEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
Boolean deleteByOrderId(@Param("orderIdFk") String orderIdFk);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.glxp.api.dao.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurPlanResponse;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PurPlanDao {
|
||||||
|
|
||||||
|
List<PurPlanResponse> queryPageList(PurPlanRequest purPlanRequest);
|
||||||
|
|
||||||
|
Boolean insert(PurPlanEntity purPlanRequest);
|
||||||
|
|
||||||
|
Boolean update(PurPlanEntity purPlanRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(@Param("ids") List<Integer> ids);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.glxp.api.dao.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PurPlanDetailDao {
|
||||||
|
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purApplyRequest);
|
||||||
|
|
||||||
|
// List<StockOrderDetailEntity> joinQueryList(PurPlanDetailRequest purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean insert(PurPlanDetailEntity purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean update(PurPlanDetailEntity purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(@Param("ids")List<Long> ids);
|
||||||
|
|
||||||
|
Boolean deleteByOrderId(@Param("orderIdFk") String orderIdFk);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.glxp.api.req.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PostPurApplyRequest {
|
||||||
|
|
||||||
|
Integer type;
|
||||||
|
int editStatus;
|
||||||
|
PurApplyEntity purApplyEntity;
|
||||||
|
List<PurApplyDetailEntity> purApplyDetailEntities;
|
||||||
|
// List<StockOrderDetailEntity> subErpOrders;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.glxp.api.req.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PostPurPlanRequest {
|
||||||
|
|
||||||
|
int editStatus;
|
||||||
|
PurPlanEntity purPlanEntity;
|
||||||
|
List<PurPlanDetailEntity> purPlanDetailEntities;
|
||||||
|
// List<StockOrderDetailEntity> subErpOrders;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.glxp.api.req.purchase;
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.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 {
|
||||||
|
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
private String orderIdFk;
|
||||||
|
|
||||||
|
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
|
||||||
|
private Long count;
|
||||||
|
|
||||||
|
|
||||||
|
private String supId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package com.glxp.api.req.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.util.page.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,50 @@
|
|||||||
|
package com.glxp.api.res.purchase;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PurOrderDetailResponse {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String orderIdFk;
|
||||||
|
private String productId;
|
||||||
|
private String productName;
|
||||||
|
private String spec;
|
||||||
|
private String batchNo;
|
||||||
|
private String expireDate;
|
||||||
|
private String productDate;
|
||||||
|
private Integer count;
|
||||||
|
private Integer reCount;
|
||||||
|
private Integer sweepCount;
|
||||||
|
private String ylqxzcrbarmc;
|
||||||
|
private String zczbhhzbapzbh;
|
||||||
|
private BigDecimal price;
|
||||||
|
private String relId;
|
||||||
|
|
||||||
|
//销售清单号(第二票)
|
||||||
|
private String secSalesListNo;
|
||||||
|
|
||||||
|
//销售发票号(第一票)
|
||||||
|
private String firstSalesInvNo;
|
||||||
|
|
||||||
|
//销售发票号(第二票)
|
||||||
|
private String secSalesInvNo;
|
||||||
|
|
||||||
|
//开票日期
|
||||||
|
private String invoiceDate;
|
||||||
|
private String manufactory;
|
||||||
|
private boolean allowNoBatch;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String serialNo;
|
||||||
|
|
||||||
|
private Integer codeId;
|
||||||
|
|
||||||
|
private int acceptCount;
|
||||||
|
private String measname;
|
||||||
|
private String supId;
|
||||||
|
|
||||||
|
private String supName;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.glxp.api.service.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyDetailRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurOrderDetailResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PurApplyDetailService {
|
||||||
|
|
||||||
|
List<PurApplyDetailEntity> queryPageList(PurApplyDetailRequest purApplyRequest);
|
||||||
|
|
||||||
|
public List<PurApplyDetailEntity> findByOrderId(String orderId);
|
||||||
|
|
||||||
|
List<PurOrderDetailResponse> joinQueryList(PurApplyDetailRequest purApplyRequest);
|
||||||
|
|
||||||
|
|
||||||
|
Boolean insert(PurApplyDetailEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean update(PurApplyDetailEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Boolean deleteByOrderId(String orderIdfK);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.glxp.api.service.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurApplyResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PurApplyService {
|
||||||
|
|
||||||
|
List<PurApplyResponse> queryPageList(PurApplyRequest purApplyRequest);
|
||||||
|
|
||||||
|
Integer insert(PurApplyEntity purApplyEntity);
|
||||||
|
|
||||||
|
Boolean update(PurApplyEntity purApplyRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(List<Long> ids);
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.glxp.api.service.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PurPlanDetailService {
|
||||||
|
|
||||||
|
// List<StockOrderDetailEntity> joinQueryList(PurPlanDetailRequest purApplyRequest);
|
||||||
|
|
||||||
|
|
||||||
|
List<PurPlanDetailEntity> findByOrderId(String orderId);
|
||||||
|
|
||||||
|
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean insert(PurPlanDetailEntity purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean update(PurPlanDetailEntity purPlanDetailRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(List<Long> ids);
|
||||||
|
|
||||||
|
Boolean deleteByOrderId(String orderIdfK);
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.glxp.api.service.purchase;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurPlanResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PurPlanService {
|
||||||
|
|
||||||
|
List<PurPlanResponse> queryPageList(PurPlanRequest purPlanRequest);
|
||||||
|
|
||||||
|
Boolean insert(PurPlanEntity purPlanRequest);
|
||||||
|
|
||||||
|
Boolean update(PurPlanEntity purPlanRequest);
|
||||||
|
|
||||||
|
Boolean deleteByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.glxp.api.service.purchase.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
|
||||||
|
import com.glxp.api.dao.purchase.PurApplyDetailDao;
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyDetailRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurOrderDetailResponse;
|
||||||
|
import com.glxp.api.service.purchase.PurApplyDetailService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PurApplyDetailImplService implements PurApplyDetailService {
|
||||||
|
|
||||||
|
|
||||||
|
@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<PurApplyDetailEntity> findByOrderId(String orderId) {
|
||||||
|
if (orderId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
PurApplyDetailRequest purApplyDetailRequest = new PurApplyDetailRequest();
|
||||||
|
purApplyDetailRequest.setOrderIdFk(orderId);
|
||||||
|
List<PurApplyDetailEntity> data = purApplyDetailDao.queryPageList(purApplyDetailRequest);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PurOrderDetailResponse> 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<PurOrderDetailResponse> 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,48 @@
|
|||||||
|
package com.glxp.api.service.purchase.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.purchase.PurApplyDao;
|
||||||
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurApplyRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurApplyResponse;
|
||||||
|
import com.glxp.api.service.purchase.PurApplyService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PurApplyServiceImpl implements PurApplyService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PurApplyDao purApplyDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PurApplyResponse> 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<PurApplyResponse> 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,74 @@
|
|||||||
|
package com.glxp.api.service.purchase.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.purchase.PurPlanDetailDao;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PurPlanDetailServiceImpl implements PurPlanDetailService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PurPlanDetailDao purPlanDetailDao;
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<StockOrderDetailEntity> joinQueryList(PurPlanDetailRequest 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 = purPlanDetailDao.joinQueryList(purApplyRequest);
|
||||||
|
// return data;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PurPlanDetailEntity> findByOrderId(String orderId) {
|
||||||
|
PurPlanDetailRequest purPlanDetailRequest = new PurPlanDetailRequest();
|
||||||
|
purPlanDetailRequest.setOrderIdFk(orderId);
|
||||||
|
List<PurPlanDetailEntity> data = purPlanDetailDao.queryPageList(purPlanDetailRequest);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(PurPlanDetailEntity purPlanDetailRequest) {
|
||||||
|
return purPlanDetailDao.insert(purPlanDetailRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(PurPlanDetailEntity purPlanDetailRequest) {
|
||||||
|
return purPlanDetailDao.update(purPlanDetailRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteByIds(List<Long> ids) {
|
||||||
|
return purPlanDetailDao.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteByOrderId(String orderIdfK) {
|
||||||
|
return purPlanDetailDao.deleteByOrderId(orderIdfK);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.glxp.api.service.purchase.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.glxp.api.dao.purchase.PurPlanDao;
|
||||||
|
import com.glxp.api.entity.purchase.PurPlanEntity;
|
||||||
|
import com.glxp.api.req.purchase.PurPlanRequest;
|
||||||
|
import com.glxp.api.res.purchase.PurPlanResponse;
|
||||||
|
import com.glxp.api.service.purchase.PurPlanService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PurPlanServiceImpl implements PurPlanService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
PurPlanDao purPlanDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PurPlanResponse> 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<PurPlanResponse> data = purPlanDao.queryPageList(purPlanRequest);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean insert(PurPlanEntity purPlanRequest) {
|
||||||
|
return purPlanDao.insert(purPlanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(PurPlanEntity purPlanRequest) {
|
||||||
|
return purPlanDao.update(purPlanRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteByIds(List<Integer> ids) {
|
||||||
|
return purPlanDao.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,124 @@
|
|||||||
|
<?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.purchase.PurApplyDao">
|
||||||
|
|
||||||
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurApplyRequest"
|
||||||
|
resultType="com.glxp.api.res.purchase.PurApplyResponse">
|
||||||
|
SELECT
|
||||||
|
pur_apply.*,
|
||||||
|
cb.employeeName createByName,
|
||||||
|
ab.employeeName auditByName,
|
||||||
|
auth_warehouse.`name` targetInvName,
|
||||||
|
auth_dept.`name` targetDeptName
|
||||||
|
FROM
|
||||||
|
pur_apply
|
||||||
|
LEFT JOIN auth_user cb ON pur_apply.createUser = cb.id
|
||||||
|
LEFT JOIN auth_user ab ON pur_apply.auditUser = ab.id
|
||||||
|
LEFT JOIN auth_warehouse ON pur_apply.targetInvCode = auth_warehouse.`code`
|
||||||
|
LEFT JOIN auth_dept ON auth_dept.`code` = pur_apply.targetDeptCode
|
||||||
|
<where>
|
||||||
|
<if test="billNo != '' and billNo != null">
|
||||||
|
AND billNo = #{billNo}
|
||||||
|
</if>
|
||||||
|
<if test="startDate != null and startDate !=''">
|
||||||
|
<![CDATA[ and DATE_FORMAT(billDate,'%Y-%m-%d')>= #{startDate}]]>
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate !=''">
|
||||||
|
<![CDATA[ and DATE_FORMAT(billDate,'%Y-%m-%d') <= #{endDate}]]>
|
||||||
|
</if>
|
||||||
|
<if test="status!=null and status!=10 and status!=11">
|
||||||
|
and pur_apply.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="status ==10">
|
||||||
|
and ( pur_apply.status = 3 or pur_apply.status=2 or pur_apply.status=4)
|
||||||
|
</if>
|
||||||
|
<if test="status ==11">
|
||||||
|
and ( pur_apply.status = 1 or pur_apply.status=2 or pur_apply.status=4)
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="deptCode != '' and deptCode != null">
|
||||||
|
AND deptCode = #{deptCode}
|
||||||
|
</if>
|
||||||
|
<if test="invCode != '' and invCode != null">
|
||||||
|
AND invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="auditUser != '' and auditUser != null">
|
||||||
|
AND auditUser = #{auditUser}
|
||||||
|
</if>
|
||||||
|
<if test="createUser != '' and createUser != null">
|
||||||
|
AND createUser = #{createUser}
|
||||||
|
</if>
|
||||||
|
<if test="applyType != null">
|
||||||
|
AND generatePlan = 1
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" keyProperty="id" keyColumn="id"
|
||||||
|
parameterType="com.glxp.api.entity.purchase.PurApplyEntity" useGeneratedKeys="true">
|
||||||
|
replace
|
||||||
|
INTO pur_apply
|
||||||
|
(
|
||||||
|
billNo,billDate,status,billType,remark,invCode,
|
||||||
|
deptCode,createUser,createTime,auditUser,auditTime,updateTime,updateUser ,auditRemark,targetInvCode,targetDeptCode,planBillNo,generatePlan
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{billNo},
|
||||||
|
#{billDate},
|
||||||
|
#{status},
|
||||||
|
#{billType},
|
||||||
|
#{remark},
|
||||||
|
#{invCode},
|
||||||
|
#{deptCode},
|
||||||
|
#{createUser},
|
||||||
|
#{createTime},
|
||||||
|
#{auditUser},
|
||||||
|
#{auditTime},
|
||||||
|
#{updateTime},
|
||||||
|
#{updateUser},
|
||||||
|
#{auditRemark},
|
||||||
|
#{targetInvCode},
|
||||||
|
#{targetDeptCode},
|
||||||
|
#{planBillNo},#{generatePlan}
|
||||||
|
)
|
||||||
|
</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.glxp.api.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="invCode != null">invCode=#{invCode},</if>
|
||||||
|
<if test="deptCode != null">deptCode=#{deptCode},</if>
|
||||||
|
<if test="auditUser != null">auditUser=#{auditUser},</if>
|
||||||
|
<if test="auditTime != null">auditTime=#{auditTime},</if>
|
||||||
|
<if test="createUser != null">createUser=#{createUser},</if>
|
||||||
|
<if test="createTime != null">createTime=#{createTime},</if>
|
||||||
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||||
|
<if test="updateUser != null">updateUser=#{updateUser},</if>
|
||||||
|
<if test="auditRemark != null">auditRemark=#{auditRemark},</if>
|
||||||
|
<if test="targetInvCode != null">targetInvCode=#{targetInvCode},</if>
|
||||||
|
<if test="targetDeptCode != null">targetDeptCode=#{targetDeptCode},</if>
|
||||||
|
<if test="planBillNo != null">planBillNo=#{planBillNo},</if>
|
||||||
|
<if test="generatePlan != null">generatePlan=#{generatePlan},</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,99 @@
|
|||||||
|
<?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.purchase.PurApplyDetailDao">
|
||||||
|
|
||||||
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurApplyDetailRequest"
|
||||||
|
resultType="com.glxp.api.entity.purchase.PurApplyDetailEntity">
|
||||||
|
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.req.purchase.PurApplyDetailRequest"
|
||||||
|
resultType="com.glxp.api.res.purchase.PurOrderDetailResponse">
|
||||||
|
SELECT
|
||||||
|
pur_apply_detail.*,
|
||||||
|
basic_products.ggxh spec,
|
||||||
|
basic_products.measname,
|
||||||
|
basic_products.manufactory,
|
||||||
|
basic_products.ylqxzcrbarmc,
|
||||||
|
basic_corp.`name` supName
|
||||||
|
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
|
||||||
|
INNER JOIN basic_corp ON pur_apply_detail.supId = basic_corp.erpId
|
||||||
|
<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.entity.purchase.PurApplyDetailEntity">
|
||||||
|
replace
|
||||||
|
INTO pur_apply_detail
|
||||||
|
(
|
||||||
|
orderIdFk,productId,productName,`count`,supId,zczbhhzbapzbh
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{orderIdFk},
|
||||||
|
#{productId},
|
||||||
|
#{productName},
|
||||||
|
#{count},
|
||||||
|
#{supId},#{zczbhhzbapzbh}
|
||||||
|
)
|
||||||
|
</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="deleteByOrderId" parameterType="map">
|
||||||
|
DELETE
|
||||||
|
FROM pur_apply_detail
|
||||||
|
WHERE orderIdFk = #{orderIdFk}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.glxp.api.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>
|
||||||
|
<if test="zczbhhzbapzbh != null">zczbhhzbapzbh=#{zczbhhzbapzbh},</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,121 @@
|
|||||||
|
<?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.purchase.PurPlanDao">
|
||||||
|
|
||||||
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurPlanRequest"
|
||||||
|
resultType="com.glxp.api.res.purchase.PurPlanResponse">
|
||||||
|
|
||||||
|
select pur_plan.* ,
|
||||||
|
cb.employeeName createByName,ab.employeeName auditByName,
|
||||||
|
inv_warehouse.name invName,inv_warehouse_sub.`name` subInvName FROM pur_plan
|
||||||
|
left JOIN auth_user cb on pur_plan.createUser = cb.id
|
||||||
|
LEFT JOIN auth_user ab on pur_plan.auditUser = ab.id
|
||||||
|
LEFT JOIN inv_warehouse on pur_plan.locStorageCode = inv_warehouse.`code`
|
||||||
|
LEFT JOIN inv_warehouse_sub on inv_warehouse_sub.code = pur_plan.invWarehouseCode
|
||||||
|
<where>
|
||||||
|
<if test="billNo != '' and billNo != null">
|
||||||
|
AND billNo = #{billNo}
|
||||||
|
</if>
|
||||||
|
<if test="startDate != null and startDate !=''">
|
||||||
|
<![CDATA[ and DATE_FORMAT(billDate,'%Y-%m-%d')>= #{startDate}]]>
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate !=''">
|
||||||
|
<![CDATA[ and DATE_FORMAT(billDate,'%Y-%m-%d') <= #{endDate}]]>
|
||||||
|
</if>
|
||||||
|
<if test="status!=null and status!=10 and status!=11">
|
||||||
|
and pur_plan.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="status ==10">
|
||||||
|
and ( pur_plan.status = 3 or pur_plan.status=2 or pur_plan.status=4)
|
||||||
|
</if>
|
||||||
|
<if test="status ==11">
|
||||||
|
and ( pur_plan.status = 1 or pur_plan.status=2 or pur_plan.status=4)
|
||||||
|
</if>
|
||||||
|
|
||||||
|
<if test="deptCode != '' and deptCode != null">
|
||||||
|
AND deptCode = #{deptCode}
|
||||||
|
</if>
|
||||||
|
<if test="invCode != '' and invCode != null">
|
||||||
|
AND invCode = #{invCode}
|
||||||
|
</if>
|
||||||
|
<if test="auditUser != '' and auditUser != null">
|
||||||
|
AND auditUser = #{auditUser}
|
||||||
|
</if>
|
||||||
|
<if test="createUser != '' and createUser != null">
|
||||||
|
AND createUser = #{createUser}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" keyProperty="id"
|
||||||
|
parameterType="com.glxp.api.entity.purchase.PurPlanEntity" useGeneratedKeys="true">
|
||||||
|
replace
|
||||||
|
INTO pur_plan
|
||||||
|
(
|
||||||
|
billNo,billDate,status,billType,remark,locStorageCode,invWarehouseCode,
|
||||||
|
deptCode,createUser,createTime,auditUser,auditTime,updateTime,auditRemark
|
||||||
|
,applyCreateUser,applyAuditUser,applyRemark,applyBillNo,stockOrderNo
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{billNo},
|
||||||
|
#{billDate},
|
||||||
|
#{status},
|
||||||
|
#{billType},
|
||||||
|
#{remark},
|
||||||
|
#{locStorageCode},
|
||||||
|
#{invWarehouseCode},
|
||||||
|
#{deptCode},
|
||||||
|
#{createUser},
|
||||||
|
#{createTime},
|
||||||
|
#{auditUser},
|
||||||
|
#{auditTime},
|
||||||
|
#{updateTime},
|
||||||
|
#{auditRemark},
|
||||||
|
#{applyCreateUser},
|
||||||
|
#{applyAuditUser},
|
||||||
|
#{applyRemark},
|
||||||
|
#{applyBillNo},
|
||||||
|
#{stockOrderNo}
|
||||||
|
)
|
||||||
|
</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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.glxp.api.entity.purchase.PurPlanEntity">
|
||||||
|
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="auditUser != null">auditUser=#{auditUser},</if>
|
||||||
|
<if test="auditTime != null">auditTime=#{auditTime},</if>
|
||||||
|
<if test="createUser != null">createUser=#{createUser},</if>
|
||||||
|
<if test="createTime != null">createTime=#{createTime},</if>
|
||||||
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||||
|
<if test="auditRemark != null">auditRemark=#{auditRemark},</if>
|
||||||
|
<if test="applyCreateUser != null">applyCreateUser=#{applyCreateUser},</if>
|
||||||
|
<if test="applyAuditUser != null">applyAuditUser=#{applyAuditUser},</if>
|
||||||
|
<if test="applyRemark != null">applyRemark=#{applyRemark},</if>
|
||||||
|
<if test="applyBillNo != null">applyBillNo=#{applyBillNo},</if>
|
||||||
|
<if test="stockOrderNo != null">stockOrderNo=#{stockOrderNo},</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.dao.purchase.PurPlanDetailDao">
|
||||||
|
|
||||||
|
<select id="queryPageList" parameterType="com.glxp.api.req.purchase.PurPlanDetailRequest"
|
||||||
|
resultType="com.glxp.api.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>
|
||||||
|
|
||||||
|
<!-- <select id="joinQueryList" parameterType="com.glxp.api.req.purchase.PurPlanDetailRequest"-->
|
||||||
|
<!-- resultType="com.glxp.api..entity.business.StockOrderDetailEntity">-->
|
||||||
|
<!-- select-->
|
||||||
|
<!-- pur_plan_detail.*,-->
|
||||||
|
<!-- basic_products.ggxh spec,basic_udirel.measname,basic_udirel.manufactory,basic_products.ylqxzcrbarmc-->
|
||||||
|
<!-- ,basic_corp.`name` supName-->
|
||||||
|
<!-- FROM pur_plan_detail-->
|
||||||
|
<!-- INNER JOIN basic_udirel on pur_plan_detail.productId = basic_udirel.id-->
|
||||||
|
<!-- INNER JOIN basic_products on basic_udirel.uuid = basic_products.uuid-->
|
||||||
|
<!-- inner join basic_corp on pur_plan_detail.supId =basic_corp.erpId-->
|
||||||
|
<!-- <where>-->
|
||||||
|
<!-- <if test="orderIdFk != '' and orderIdFk != null">-->
|
||||||
|
<!-- AND orderIdFk = #{orderIdFk}-->
|
||||||
|
<!-- AND basic_products.diType=1-->
|
||||||
|
<!-- </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.entity.purchase.PurPlanDetailEntity">
|
||||||
|
replace
|
||||||
|
INTO pur_plan_detail
|
||||||
|
(
|
||||||
|
orderIdFk,productId,productName,`count`,supId,zczbhhzbapzbh
|
||||||
|
)
|
||||||
|
values (
|
||||||
|
#{orderIdFk},
|
||||||
|
#{productId},
|
||||||
|
#{productName},
|
||||||
|
#{count},
|
||||||
|
#{supId},#{zczbhhzbapzbh}
|
||||||
|
)
|
||||||
|
</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="deleteByOrderId" parameterType="map">
|
||||||
|
DELETE
|
||||||
|
FROM pur_plan_detail
|
||||||
|
WHERE orderIdFk = #{orderIdFk}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.glxp.api.entity.purchase.PurPlanDetailEntity">
|
||||||
|
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>
|
||||||
|
<if test="zczbhhzbapzbh != null">zczbhhzbapzbh=#{zczbhhzbapzbh},</if>
|
||||||
|
</trim>
|
||||||
|
WHERE id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue