采购计划代码提交

master
郑明梁 2 years ago
parent cb4d5a52ba
commit f7d3031ef0

@ -162,6 +162,7 @@ public class ConstantStatus {
public static final int FROM_PEACE_CHANGE = 8; //平衡补单
public static final int FROM_COPY = 10; //单据复制
public static final int FROM_COUNT = 11; //盘点单据转单
public static final int FROM_PLAN = 12; //申购计划转单
//DI类型

@ -93,21 +93,8 @@ public class PurApplyController {
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("提交成功!");
}
@ -177,6 +164,9 @@ public class PurApplyController {
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd"));
purPlanEntity.setBillNo(billNo);
purPlanEntity.setBillDate(new Date());
purPlanEntity.setInvCode(purApplyEntity.getInvCode());
purPlanEntity.setDeptCode(purApplyEntity.getDeptCode());
purPlanEntity.setUpdateUser(purApplyEntity.getUpdateUser());
purPlanEntity.setStatus(ConstantStatus.APPLY_DRAFT);
purPlanEntity.setBillType("purPlan");
purPlanEntity.setCreateTime(new Date());
@ -328,7 +318,7 @@ public class PurApplyController {
/**
*
*
*/
@AuthRuleAnnotation("")
@PostMapping("/purchase/apply/delApplyDetailAll")

@ -9,7 +9,11 @@ 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.constant.ConstantType;
import com.glxp.api.entity.basic.BasicCorpEntity;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.purchase.PurApplyDetailEntity;
import com.glxp.api.entity.purchase.PurApplyEntity;
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
@ -20,14 +24,18 @@ 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.PurOrderDetailResponse;
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.inout.IoOrderDetailBizService;
import com.glxp.api.service.inout.IoOrderService;
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.CustomUtil;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.OrderNoTypeBean;
import lombok.RequiredArgsConstructor;
@ -37,6 +45,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -64,8 +73,13 @@ public class PurPlanController {
@Resource
CustomerService customerService;
// @Resource
// GennerOrderUtils gennerOrderUtils;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
IoOrderService ioOrderService;
@Resource
IoOrderDetailBizService ioOrderDetailBizService;
// @Resource
// BasicCorpService basicCorpService;
// @Resource
@ -76,48 +90,40 @@ public class PurPlanController {
// @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("提交成功!");
// }
//
//
/**
*
*/
@RepeatSubmit()
@AuthRuleAnnotation("")
@PostMapping("/purchase/plan/postOrder")
public BaseResponse postOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
Long userId = customerService.getUserId();
PurPlanEntity purPlanEntity = postPurPlanRequest.getPurPlanEntity();
purPlanEntity.setCreateUser(userId + "");
purPlanEntity.setCreateTime(new Date());
purPlanEntity.setUpdateTime(new Date());
purPlanEntity.setUpdateUser(userId + "");
purPlanEntity.setStatus(postPurPlanRequest.getEditStatus()); //草稿状态
if(postPurPlanRequest.getType()!=null){
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
purPlanEntity.setBillNo(billNo);
}
if (purPlanEntity.getId() == null) {
purPlanService.insert(purPlanEntity);
} else {
purPlanService.update(purPlanEntity);
}
return ResultVOUtils.success("提交成功!");
}
/**
*
*/
@ -137,115 +143,97 @@ public class PurPlanController {
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("更新成功!");
// }
/**
*
*/
@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() + "");
if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) {
if (CollUtil.isNotEmpty(purPlanDetailEntities) && postPurPlanRequest.isAutoPurchase()==true
&& StrUtil.isNotEmpty(postPurPlanRequest.getTargetSubInv()) && StrUtil.isNotEmpty(postPurPlanRequest.getTargetBillAction()) ) {
//生产单据表信息
IoOrderEntity ioOrderEntity=new IoOrderEntity();
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER ,"yyyyMMdd")));
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
ioOrderEntity.setAction(postPurPlanRequest.getTargetBillAction());
ioOrderEntity.setFromCorp("1111");
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
ioOrderEntity.setStatus(1);
ioOrderEntity.setDealStatus(1);
ioOrderEntity.setCreateTime(new Date());
ioOrderEntity.setCreateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser());
ioOrderEntity.setUpdateTime(new Date());
ioOrderEntity.setUpdateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser());
ioOrderEntity.setCustomerId("110");
ioOrderEntity.setDeptCode(postPurPlanRequest.getTargetDeptCode());
ioOrderEntity.setInvCode(postPurPlanRequest.getTargetSubInv());
ioOrderService.insertOrder(ioOrderEntity);
//插入业务单表
//查询详情表
List<PurPlanDetailEntity> purPlanDetailEntityList=purPlanDetailService.findByOrderId(postPurPlanRequest.getPurPlanEntity().getId()+"");
for (PurPlanDetailEntity obj:purPlanDetailEntityList){
BasicProductsEntity basicProductsEntity=purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
IoOrderDetailBizEntity ioOrderDetailBizEntity=new IoOrderDetailBizEntity();
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getId()+"");
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
ioOrderDetailBizEntity.setCount(obj.getCount());
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
if(basicProductsEntity.getPrice()!=null) {
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
}
ioOrderDetailBizEntity.setSupId(obj.getSupId());
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
}
purApplyEntity.setStockOrderNo(ioOrderEntity.getBillNo());
purPlanService.update(purApplyEntity);
}
}
return ResultVOUtils.success("更新成功!");
}
//
//
// /**
@ -270,21 +258,21 @@ public class PurPlanController {
// }
//
//
//// /**
//// * 查询采购计划列表
//// */
//// @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);
////
//// }
/**
*
*/
@GetMapping("/purchase/plan/list/detail")
public BaseResponse detailList(PurPlanDetailRequest purApplyDetailRequest) {
List<PurOrderDetailResponse> purApplyDetailEntities = purPlanDetailService.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);
}
//
//
// /**
@ -347,16 +335,16 @@ public class PurPlanController {
/**
*
*/
@PostMapping("/purchase/plan/addPlanDetail")
public BaseResponse addPlanDetail(@RequestBody PurPlanRequest purApplyRequest) {
@PostMapping("/purchase/plan/addPlanDetailAndApply")
public BaseResponse addPlanDetailAndApply(@RequestBody PurPlanRequest purPlanRequest) {
if (purApplyRequest.getRId() == null && purApplyRequest.getId() == null) {
if (purPlanRequest.getApplyId() == null || purPlanRequest.getId() == null) {
return ResultVOUtils.error(999,"参数错误!");
}
//查询申购单详情
PurApplyDetailRequest purApplyDetailRequest=new PurApplyDetailRequest();
purApplyDetailRequest.setOrderIdFk(purApplyRequest.getRId());
purApplyDetailRequest.setOrderIdFk(purPlanRequest.getApplyId()+"");
List<PurApplyDetailEntity> purApplyDetailEntityList=purApplyDetailService.selectPurApplyDetailList(purApplyDetailRequest);
//使用stream拷贝list
List<PurPlanDetailEntity> purPlanDetailEntityList = purApplyDetailEntityList.stream()
@ -368,8 +356,32 @@ public class PurPlanController {
.collect(Collectors.toList());
for (PurPlanDetailEntity obj:purPlanDetailEntityList){
obj.setOrderIdFk(purApplyRequest.getId()+"");
obj.setOrderIdFk(purPlanRequest.getId()+"");
}
//获取详情表信息
PurPlanDetailRequest purPlanDetailRequest=new PurPlanDetailRequest();
purPlanDetailRequest.setOrderIdFk(purPlanRequest.getId() + "");
List<PurPlanDetailEntity> purApplyDetailEntities=purPlanDetailService.getPurPlanDetailEntityList(purPlanDetailRequest);
List<Long> ids=new ArrayList<>();
for (PurPlanDetailEntity obj:purApplyDetailEntities){
for (PurPlanDetailEntity obj1:purPlanDetailEntityList){
if(obj.getProductId().equals(obj1.getProductId())){
//获取存在在详情表和申购单里面一样的产品
ids.add(obj.getId().longValue());
break;
}
}
}
//删除存在的产品
if(ids.size()>0){
purPlanDetailService.deleteByIds(ids);
}
boolean falg= purPlanDetailService.insertPurPlanDetailEntity(purPlanDetailEntityList);
if(falg){
//查询申购单
@ -380,6 +392,23 @@ public class PurPlanController {
}
}
/**
*
*/
@PostMapping("/purchase/plan/addPlanDetail")
public BaseResponse addPlanDetail(@RequestBody PurPlanDetailEntity purPlanDetailEntity) {
boolean falg=purPlanDetailService.insert(purPlanDetailEntity);
if(falg){
return ResultVOUtils.success("添加成功");
}else {
return ResultVOUtils.success("添加失败");
}
}
/**
*
*/
@ -396,4 +425,31 @@ public class PurPlanController {
Long id=purPlanEntity.getId();
return ResultVOUtils.success(id);
}
/**
*
*/
@AuthRuleAnnotation("")
@PostMapping("/purchase/plan/delPlanDetailAll")
public BaseResponse delApplyDetailAll(@RequestBody PurApplyEntity purApplyEntity) {
if(purApplyEntity.getId()!=null){
purPlanService.deleteById(purApplyEntity.getId());
purPlanDetailService.deleteByOrderId(purApplyEntity.getId() + "" );
}else {
return ResultVOUtils.error(999,"参数有误!");
}
return ResultVOUtils.success();
}
/**
*
*/
@RepeatSubmit()
@PostMapping("/purchase/plan/updateDetail")
public BaseResponse detailEdit(@RequestBody PurPlanDetailEntity purPlanDetailEntity) {
purPlanDetailService.update(purPlanDetailEntity);
return ResultVOUtils.success("修改成功");
}
}

@ -20,4 +20,6 @@ public interface PurPlanDao {
Boolean deleteByIds(@Param("ids") List<Integer> ids);
Boolean deleteById(@Param("id") long id);
}

@ -1,9 +1,12 @@
package com.glxp.api.dao.purchase;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.basic.ProductInfoEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.req.purchase.PurPlanDetailRequest;
import com.glxp.api.res.purchase.PurOrderDetailResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -13,7 +16,7 @@ import java.util.List;
public interface PurPlanDetailDao {
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purApplyRequest);
// List<StockOrderDetailEntity> joinQueryList(PurPlanDetailRequest purPlanDetailRequest);
List<PurOrderDetailResponse> joinQueryList(PurPlanDetailRequest purPlanDetailRequest);
Boolean insert(PurPlanDetailEntity purPlanDetailRequest);
@ -25,4 +28,6 @@ public interface PurPlanDetailDao {
boolean insertPurPlanDetailEntity(@Param("datas") List<PurPlanDetailEntity> purPlanDetailEntityList);
BasicProductsEntity selectIoOrderDetailBiz(@Param("id") long id);
}

@ -14,5 +14,11 @@ public class PostPurPlanRequest {
PurPlanEntity purPlanEntity;
List<PurPlanDetailEntity> purPlanDetailEntities;
// List<StockOrderDetailEntity> subErpOrders;
Integer type;
boolean autoPurchase;
String targetSubInv;
String targetBillAction;
String targetDeptCode;
}

@ -90,7 +90,9 @@ public class PurPlanRequest extends ListPageRequest {
private String startDate;
private String endDate;
private String rId;
private Long applyId;
}

@ -31,14 +31,7 @@ public class PurPlanResponse {
*
*/
private String remark;
/**
*
*/
private String locStorageCode;
/**
*
*/
private String invWarehouseCode;
private String invCode;
/**
*
*/
@ -65,6 +58,7 @@ public class PurPlanResponse {
private String auditByName;
private String invName;
private String subInvName;
private String deptName;
private String auditRemark;
private String applyCreateBy; //申购人

@ -2,20 +2,26 @@ package com.glxp.api.service.purchase;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.req.purchase.PurPlanDetailRequest;
import com.glxp.api.res.purchase.PurOrderDetailResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface PurPlanDetailService {
// List<StockOrderDetailEntity> joinQueryList(PurPlanDetailRequest purApplyRequest);
List<PurOrderDetailResponse> joinQueryList(PurPlanDetailRequest purApplyRequest);
List<PurPlanDetailEntity> findByOrderId(String orderId);
List<PurPlanDetailEntity> queryPageList(PurPlanDetailRequest purPlanDetailRequest);
List<PurPlanDetailEntity> getPurPlanDetailEntityList(PurPlanDetailRequest purPlanDetailRequest);
Boolean insert(PurPlanDetailEntity purPlanDetailRequest);
Boolean update(PurPlanDetailEntity purPlanDetailRequest);
@ -25,4 +31,7 @@ public interface PurPlanDetailService {
Boolean deleteByOrderId(String orderIdfK);
boolean insertPurPlanDetailEntity(List<PurPlanDetailEntity> purPlanDetailEntityList);
BasicProductsEntity selectIoOrderDetailBiz(long id);
}

@ -5,6 +5,7 @@ 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 org.apache.ibatis.annotations.Param;
import java.util.List;
@ -18,5 +19,7 @@ public interface PurPlanService {
Boolean deleteByIds(List<Integer> ids);
Boolean deleteById(long id);
}

@ -2,8 +2,11 @@ package com.glxp.api.service.purchase.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.purchase.PurPlanDetailDao;
import com.glxp.api.entity.basic.BasicProductsEntity;
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
import com.glxp.api.req.purchase.PurPlanDetailRequest;
import com.glxp.api.res.purchase.PurOrderDetailResponse;
import com.glxp.api.service.purchase.PurPlanDetailService;
import org.springframework.stereotype.Service;
@ -17,18 +20,18 @@ 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<PurOrderDetailResponse> 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<PurOrderDetailResponse> data = purPlanDetailDao.joinQueryList(purApplyRequest);
return data;
}
@Override
public List<PurPlanDetailEntity> findByOrderId(String orderId) {
@ -51,6 +54,11 @@ public class PurPlanDetailServiceImpl implements PurPlanDetailService {
return data;
}
@Override
public List<PurPlanDetailEntity> getPurPlanDetailEntityList(PurPlanDetailRequest purPlanDetailRequest) {
return purPlanDetailDao.queryPageList(purPlanDetailRequest);
}
@Override
public Boolean insert(PurPlanDetailEntity purPlanDetailRequest) {
return purPlanDetailDao.insert(purPlanDetailRequest);
@ -76,4 +84,9 @@ public class PurPlanDetailServiceImpl implements PurPlanDetailService {
public boolean insertPurPlanDetailEntity(List<PurPlanDetailEntity> purPlanDetailEntityList) {
return purPlanDetailDao.insertPurPlanDetailEntity(purPlanDetailEntityList);
}
@Override
public BasicProductsEntity selectIoOrderDetailBiz(long id) {
return purPlanDetailDao.selectIoOrderDetailBiz(id);
}
}

@ -45,4 +45,9 @@ public class PurPlanServiceImpl implements PurPlanService {
public Boolean deleteByIds(List<Integer> ids) {
return purPlanDao.deleteByIds(ids);
}
@Override
public Boolean deleteById(long id) {
return purPlanDao.deleteById(id);
}
}

@ -60,6 +60,17 @@ public class CustomUtil {
return false;
}
//生成当前时间字符串
public static String getDate(){
Calendar ca = Calendar.getInstance();
String year = String.valueOf(ca.get(Calendar.YEAR));//获取年份
String month=String.valueOf(ca.get(Calendar.MONTH));//获取月份
String day=String.valueOf(ca.get(Calendar.DATE));//获取日
String minute=String.valueOf(ca.get(Calendar.MINUTE));//分
String hour=String.valueOf(ca.get(Calendar.HOUR));//小时
String second=String.valueOf(ca.get(Calendar.SECOND));//秒
return year+month+day+hour+minute+second;
}
}

@ -111,6 +111,7 @@
<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="applyCreateUser != null">applyCreateUser=#{applyCreateUser},</if>
<if test="applyAuditUser != null">applyAuditUser=#{applyAuditUser},</if>
@ -121,4 +122,9 @@
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="long">
DELETE FROM pur_plan
WHERE id = #{id}
</delete>
</mapper>

@ -21,30 +21,34 @@
</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>-->
<select id="joinQueryList" parameterType="com.glxp.api.req.purchase.PurPlanDetailRequest"
resultType="com.glxp.api.res.purchase.PurOrderDetailResponse">
SELECT
pur_plan_detail.*,
basic_products.ggxh spec,
basic_products.measname,
basic_products.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"
@ -110,4 +114,20 @@
</foreach>
</insert>
<select id="selectIoOrderDetailBiz" parameterType="long"
resultType="com.glxp.api.entity.basic.BasicProductsEntity">
SELECT
b2.*
FROM
pur_plan_detail p1
LEFT JOIN basic_udirel b1 on b1.id=p1.productId
LEFT JOIN basic_products b2 on b1.uuid = b2 .uuid
<where>
<if test="id != null and id!='' ">
AND p1.id = #{id}
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save