|
|
|
package com.glxp.api.controller.purchase;
|
|
|
|
|
|
|
|
import com.glxp.api.service.purchase.impl.PurOrderDetailService;
|
|
|
|
import com.glxp.api.service.purchase.impl.PurPlanDetailService;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
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.PurApplyEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderDetailEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurOrderEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
|
|
|
import com.glxp.api.req.purchase.PostPurOrderRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurOrderDetailRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurOrderRequest;
|
|
|
|
import com.glxp.api.req.purchase.PurPlanDetailRequest;
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
import com.glxp.api.res.purchase.PurOrderDetailResponse;
|
|
|
|
import com.glxp.api.res.purchase.PurOrderResponse;
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailBizService;
|
|
|
|
import com.glxp.api.service.inout.IoOrderService;
|
|
|
|
import com.glxp.api.service.purchase.PurOrderService;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* pur
|
|
|
|
*
|
|
|
|
* @author anthony.ywj
|
|
|
|
* @date 2022-10-12
|
|
|
|
*/
|
|
|
|
@Validated
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@RestController
|
|
|
|
public class PurOrderController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
PurOrderService purOrderService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
PurPlanDetailService purPlanDetailService;
|
|
|
|
@Resource
|
|
|
|
PurOrderDetailService purOrderDetailService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
CustomerService customerService;
|
|
|
|
@Resource
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
@Resource
|
|
|
|
IoOrderService ioOrderService;
|
|
|
|
@Resource
|
|
|
|
IoOrderDetailBizService ioOrderDetailBizService;
|
|
|
|
@Resource
|
|
|
|
IoPurChangeService purChangeService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增采购计划
|
|
|
|
*/
|
|
|
|
@RepeatSubmit()
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@PostMapping("/purchase/order/postOrder")
|
|
|
|
public BaseResponse postOrder(@RequestBody PostPurOrderRequest postPurOrderRequest) {
|
|
|
|
|
|
|
|
if (postPurOrderRequest.getPurOrderEntity().getArrivalTime().compareTo(postPurOrderRequest.getPurOrderEntity().getCreateTime()) == -1) {
|
|
|
|
return ResultVOUtils.error(999, "到货时间不能小于创建时间!");
|
|
|
|
}
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
PurOrderEntity purOrderEntity = postPurOrderRequest.getPurOrderEntity();
|
|
|
|
Long id = purOrderEntity.getId();
|
|
|
|
purOrderEntity.setCreateUser(userId + "");
|
|
|
|
purOrderEntity.setCreateTime(new Date());
|
|
|
|
purOrderEntity.setUpdateTime(new Date());
|
|
|
|
purOrderEntity.setUpdateUser(userId + "");
|
|
|
|
purOrderEntity.setStatus(postPurOrderRequest.getEditStatus()); //草稿状态
|
|
|
|
purOrderEntity.setBillType(ConstantStatus.BUS_ORDER_CGDD);
|
|
|
|
if (postPurOrderRequest.getType() != null) {
|
|
|
|
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd"));
|
|
|
|
purOrderEntity.setBillNo(billNo);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (purOrderEntity.getId() == null) {
|
|
|
|
purOrderService.insert(purOrderEntity);
|
|
|
|
} else {
|
|
|
|
purOrderService.update(purOrderEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询采购计划列表
|
|
|
|
*/
|
|
|
|
@GetMapping("/purchase/order/list")
|
|
|
|
public BaseResponse list(PurOrderRequest purOrderRequest) {
|
|
|
|
|
|
|
|
if (purOrderRequest.getStatus() == null) {
|
|
|
|
purOrderRequest.setStatus(11); //查询未审核和草稿状态
|
|
|
|
}
|
|
|
|
|
|
|
|
List<PurOrderResponse> purApplyEntities = purOrderService.queryPageList(purOrderRequest);
|
|
|
|
PageInfo<PurOrderResponse> pageInfo;
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
PageSimpleResponse<PurOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询采购订单列表
|
|
|
|
*/
|
|
|
|
@GetMapping("/purchase/order/auditList")
|
|
|
|
public BaseResponse auditList(PurOrderRequest purOrderRequest) {
|
|
|
|
|
|
|
|
if (purOrderRequest.getStatus() == null) {
|
|
|
|
purOrderRequest.setStatus(10); //查询未审核和已审核状态
|
|
|
|
}
|
|
|
|
List<PurOrderResponse> purApplyEntities = purOrderService.queryPageList(purOrderRequest);
|
|
|
|
PageInfo<PurOrderResponse> pageInfo;
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
PageSimpleResponse<PurOrderResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 审核采购订单
|
|
|
|
*/
|
|
|
|
@RepeatSubmit()
|
|
|
|
@PostMapping("/purchase/order/auditOrder")
|
|
|
|
public BaseResponse auditOrder(@RequestBody PostPurOrderRequest postPurOrderRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
PurOrderEntity purOrderEntity = postPurOrderRequest.getPurOrderEntity();
|
|
|
|
purOrderEntity.setUpdateTime(new Date());
|
|
|
|
purOrderEntity.setUpdateUser(userId + "");
|
|
|
|
purOrderEntity.setAuditUser(userId + "");
|
|
|
|
purOrderEntity.setAuditTime(new Date());
|
|
|
|
purOrderEntity.setStatus(postPurOrderRequest.getEditStatus());
|
|
|
|
if (postPurOrderRequest.getEditStatus() == 4) {
|
|
|
|
purOrderService.update(purOrderEntity);
|
|
|
|
} else if (postPurOrderRequest.getEditStatus() == 3) {
|
|
|
|
Long id = purOrderEntity.getId();
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntityList = purOrderDetailService.findByOrderId(purOrderEntity.getId() + "");
|
|
|
|
//判断是不是存在同一个供应商产品
|
|
|
|
Map<String, List<PurOrderDetailEntity>> purOrderDetailMap = purOrderDetailEntityList.stream().collect(Collectors.groupingBy(PurOrderDetailEntity::getSupId));
|
|
|
|
if (purOrderDetailMap.size() > 1) {
|
|
|
|
for (String key : purOrderDetailMap.keySet()) {
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailMap.get(key);
|
|
|
|
PurOrderEntity purOrderEntity1 = new PurOrderEntity();
|
|
|
|
purOrderEntity1 = purOrderEntity;
|
|
|
|
purOrderEntity1.setId(null);
|
|
|
|
purOrderEntity1.setSupId(key);
|
|
|
|
purOrderEntity1.setBillNo(gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.CG_ORDER, "yyyyMMdd")));
|
|
|
|
purOrderService.insert(purOrderEntity1);
|
|
|
|
for (PurOrderDetailEntity purOrderDetailEntity : purOrderDetailEntities) {
|
|
|
|
purOrderDetailEntity.setId(null);
|
|
|
|
purOrderDetailEntity.setOrderIdFk(purOrderEntity1.getId() + "");
|
|
|
|
}
|
|
|
|
purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailMap.get(key));
|
|
|
|
}
|
|
|
|
purOrderService.deleteById(id);
|
|
|
|
purOrderDetailService.deleteByOrderId(id + "");
|
|
|
|
}else if (purOrderDetailMap.size() == 1) {
|
|
|
|
//判断要是往来单位是空的就从详情里面取
|
|
|
|
if(StrUtil.isBlank(purOrderEntity.getSupId())){
|
|
|
|
for (String key : purOrderDetailMap.keySet()) {
|
|
|
|
purOrderEntity.setSupId(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
purOrderService.update(purOrderEntity);
|
|
|
|
}else{
|
|
|
|
purOrderService.update(purOrderEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
purChangeService.purOrderChange(purOrderEntity);
|
|
|
|
|
|
|
|
// String billNo = "";
|
|
|
|
// List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + "");
|
|
|
|
//
|
|
|
|
// //对计划单里面的供应商进行分组
|
|
|
|
// Map<String, List<PurOrderDetailEntity>> map = purOrderDetailEntities.stream().collect(Collectors.groupingBy(PurOrderDetailEntity::getSupId));
|
|
|
|
//
|
|
|
|
// if (postPurOrderRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) {
|
|
|
|
//
|
|
|
|
// if (CollUtil.isNotEmpty(purOrderDetailEntities) && postPurOrderRequest.isAutoPurchase() == true
|
|
|
|
// && StrUtil.isNotEmpty(postPurOrderRequest.getTargetSubInv()) && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) {
|
|
|
|
//
|
|
|
|
// for (Map.Entry<String, List<PurOrderDetailEntity>> m : map.entrySet()) {
|
|
|
|
// //生产单据表信息
|
|
|
|
// 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(postPurOrderRequest.getTargetBillAction());
|
|
|
|
// ioOrderEntity.setFromCorp(m.getKey());
|
|
|
|
// ioOrderEntity.setFromType(ConstantStatus.FROM_Order);
|
|
|
|
// ioOrderEntity.setStatus(1);
|
|
|
|
// ioOrderEntity.setDealStatus(1);
|
|
|
|
// ioOrderEntity.setOrderType(1);
|
|
|
|
// ioOrderEntity.setCreateTime(new Date());
|
|
|
|
// ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
|
|
|
|
// ioOrderEntity.setUpdateTime(new Date());
|
|
|
|
// ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser());
|
|
|
|
// ioOrderEntity.setCustomerId("110");
|
|
|
|
// ioOrderEntity.setDeptCode(postPurOrderRequest.getTargetDeptCode());
|
|
|
|
// ioOrderEntity.setInvCode(postPurOrderRequest.getTargetSubInv());
|
|
|
|
// ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
// billNo += ioOrderEntity.getBillNo() + ",";
|
|
|
|
// //插入业务单表
|
|
|
|
// for (PurOrderDetailEntity obj : m.getValue()) {
|
|
|
|
// BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId());
|
|
|
|
// IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity();
|
|
|
|
// ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo());
|
|
|
|
// 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);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1));
|
|
|
|
// purOrderService.update(purOrderEntity);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
return ResultVOUtils.success("更新成功!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询采购订单列表
|
|
|
|
*/
|
|
|
|
@GetMapping("/purchase/order/list/detail")
|
|
|
|
public BaseResponse detailList(PurOrderDetailRequest purApplyDetailRequest) {
|
|
|
|
|
|
|
|
List<PurOrderDetailResponse> purOrderDetailResponseList = purOrderDetailService.joinQueryList(purApplyDetailRequest);
|
|
|
|
PageInfo<PurOrderDetailResponse> pageInfo;
|
|
|
|
pageInfo = new PageInfo<>(purOrderDetailResponseList);
|
|
|
|
PageSimpleResponse<PurOrderDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setList(purOrderDetailResponseList);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询采购订单明细列表
|
|
|
|
*
|
|
|
|
* @param purOrderDetailRequest
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/purchase/order/list/getDetailList")
|
|
|
|
public BaseResponse getDetailList(PurOrderDetailRequest purOrderDetailRequest) {
|
|
|
|
List<PurOrderDetailResponse> list = purOrderDetailService.getDetailList(purOrderDetailRequest);
|
|
|
|
PageInfo<PurOrderDetailResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加申购单到采购单里面
|
|
|
|
*/
|
|
|
|
@PostMapping("/purchase/order/addPlanDetailAndOrder")
|
|
|
|
public BaseResponse addPlanDetailAndOrder(@RequestBody PurOrderRequest purOrderRequest) {
|
|
|
|
|
|
|
|
if (purOrderRequest.getApplyId() == null || purOrderRequest.getId() == null) {
|
|
|
|
return ResultVOUtils.error(999, "参数错误!");
|
|
|
|
}
|
|
|
|
|
|
|
|
//查询申购单详情
|
|
|
|
PurPlanDetailRequest purPlanDetailRequest = new PurPlanDetailRequest();
|
|
|
|
purPlanDetailRequest.setOrderIdFk(purOrderRequest.getApplyId() + "");
|
|
|
|
List<PurPlanDetailEntity> purApplyDetailEntityList = purPlanDetailService.getPurPlanDetailEntityList(purPlanDetailRequest);
|
|
|
|
//使用stream拷贝list
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntityList = purApplyDetailEntityList.stream()
|
|
|
|
.map(e -> {
|
|
|
|
PurOrderDetailEntity d = new PurOrderDetailEntity();
|
|
|
|
BeanUtils.copyProperties(e, d);
|
|
|
|
return d;
|
|
|
|
})
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
for (PurOrderDetailEntity obj : purOrderDetailEntityList) {
|
|
|
|
obj.setOrderIdFk(purOrderRequest.getId() + "");
|
|
|
|
}
|
|
|
|
//获取详情表信息
|
|
|
|
PurOrderDetailRequest PurOrderDetailRequest = new PurOrderDetailRequest();
|
|
|
|
PurOrderDetailRequest.setOrderIdFk(purOrderRequest.getId() + "");
|
|
|
|
List<PurOrderDetailEntity> purOrderDetailEntities = purOrderDetailService.getPurOrderDetailEntityList(PurOrderDetailRequest);
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
|
for (PurOrderDetailEntity obj : purOrderDetailEntities) {
|
|
|
|
for (PurOrderDetailEntity obj1 : purOrderDetailEntityList) {
|
|
|
|
if (obj.getProductId().equals(obj1.getProductId())) {
|
|
|
|
//获取存在在详情表和申购单里面一样的产品
|
|
|
|
ids.add(obj.getId().longValue());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//删除存在的产品
|
|
|
|
if (ids.size() > 0) {
|
|
|
|
purOrderDetailService.deleteByIds(ids);
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean falg = purOrderDetailService.insertPurOrderDetailEntity(purOrderDetailEntityList);
|
|
|
|
if (falg) {
|
|
|
|
//查询申购单
|
|
|
|
return ResultVOUtils.success("添加成功");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
return ResultVOUtils.success("添加失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加产品到采购单里面
|
|
|
|
*/
|
|
|
|
@PostMapping("/purchase/order/addOrderDetail")
|
|
|
|
public BaseResponse addOrderDetail(@RequestBody PurOrderDetailEntity purOrderDetailEntity) {
|
|
|
|
|
|
|
|
boolean falg = purOrderDetailService.insert(purOrderDetailEntity);
|
|
|
|
if (falg) {
|
|
|
|
return ResultVOUtils.success("添加成功");
|
|
|
|
} else {
|
|
|
|
return ResultVOUtils.success("添加失败");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增计划单
|
|
|
|
*/
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@PostMapping("/purchase/order/add")
|
|
|
|
public BaseResponse add() {
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
PurOrderEntity purOrderEntity = new PurOrderEntity();
|
|
|
|
purOrderEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
purOrderEntity.setCreateUser(userId + "");
|
|
|
|
purOrderEntity.setCreateTime(new Date());
|
|
|
|
purOrderEntity.setUpdateTime(new Date());
|
|
|
|
purOrderEntity.setUpdateUser(userId + "");
|
|
|
|
purOrderService.insert(purOrderEntity);
|
|
|
|
Long id = purOrderEntity.getId();
|
|
|
|
return ResultVOUtils.success(id);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除申购单和详情
|
|
|
|
*/
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
@PostMapping("/purchase/order/delOrderDetailAll")
|
|
|
|
public BaseResponse delApplyDetailAll(@RequestBody PurApplyEntity purApplyEntity) {
|
|
|
|
|
|
|
|
if (purApplyEntity.getId() != null) {
|
|
|
|
purOrderService.deleteById(purApplyEntity.getId());
|
|
|
|
purOrderDetailService.deleteByOrderId(purApplyEntity.getId() + "");
|
|
|
|
} else {
|
|
|
|
return ResultVOUtils.error(999, "参数有误!");
|
|
|
|
}
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改计划详情单
|
|
|
|
*/
|
|
|
|
@RepeatSubmit()
|
|
|
|
@PostMapping("/purchase/order/updateDetail")
|
|
|
|
public BaseResponse detailEdit(@RequestBody PurOrderDetailEntity purOrderDetailEntity) {
|
|
|
|
|
|
|
|
if (StrUtil.isBlank(purOrderDetailEntity.getSupId())) {
|
|
|
|
purOrderDetailEntity.setSupId(purOrderDetailEntity.getSupName());
|
|
|
|
}
|
|
|
|
|
|
|
|
purOrderDetailService.update(purOrderDetailEntity);
|
|
|
|
return ResultVOUtils.success("修改成功");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除采购订单
|
|
|
|
*
|
|
|
|
* @param ids 主键串
|
|
|
|
*/
|
|
|
|
@DeleteMapping("/purchase/order/detail/{ids}")
|
|
|
|
public BaseResponse detailRemove(@NotEmpty(message = "主键不能为空")
|
|
|
|
@PathVariable Long[] ids) {
|
|
|
|
|
|
|
|
purOrderDetailService.deleteByIds(Arrays.asList(ids));
|
|
|
|
return ResultVOUtils.success("删除成功");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询产品供应商
|
|
|
|
*
|
|
|
|
* @param purOrderDetailEntity
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@PostMapping("/purchase/order/filterSupList")
|
|
|
|
public BaseResponse filterSupList(@RequestBody PurOrderDetailEntity purOrderDetailEntity) {
|
|
|
|
|
|
|
|
List<BasicCorpEntity> selectsupList = purOrderDetailService.selectsupList(purOrderDetailEntity);
|
|
|
|
return ResultVOUtils.success(selectsupList);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|