|
|
@ -9,7 +9,11 @@ import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.ConstantStatus;
|
|
|
|
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.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.PurApplyDetailEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurApplyEntity;
|
|
|
|
import com.glxp.api.entity.purchase.PurPlanDetailEntity;
|
|
|
|
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.req.purchase.PurPlanRequest;
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
|
|
import com.glxp.api.res.basic.UdiRelevanceResponse;
|
|
|
|
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.res.purchase.PurPlanResponse;
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
import com.glxp.api.service.basic.BasicCorpService;
|
|
|
|
import com.glxp.api.service.basic.BasicCorpService;
|
|
|
|
import com.glxp.api.service.basic.UdiRelevanceService;
|
|
|
|
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.PurApplyDetailService;
|
|
|
|
import com.glxp.api.service.purchase.PurApplyService;
|
|
|
|
import com.glxp.api.service.purchase.PurApplyService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanDetailService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanService;
|
|
|
|
import com.glxp.api.service.purchase.PurPlanService;
|
|
|
|
|
|
|
|
import com.glxp.api.util.CustomUtil;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@ -37,6 +45,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -64,8 +73,13 @@ public class PurPlanController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
CustomerService customerService;
|
|
|
|
CustomerService customerService;
|
|
|
|
// @Resource
|
|
|
|
@Resource
|
|
|
|
// GennerOrderUtils gennerOrderUtils;
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IoOrderService ioOrderService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
IoOrderDetailBizService ioOrderDetailBizService;
|
|
|
|
|
|
|
|
|
|
|
|
// @Resource
|
|
|
|
// @Resource
|
|
|
|
// BasicCorpService basicCorpService;
|
|
|
|
// BasicCorpService basicCorpService;
|
|
|
|
// @Resource
|
|
|
|
// @Resource
|
|
|
@ -76,48 +90,40 @@ public class PurPlanController {
|
|
|
|
// @Resource
|
|
|
|
// @Resource
|
|
|
|
// StockOrderService stockOrderService;
|
|
|
|
// StockOrderService stockOrderService;
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
/**
|
|
|
|
// * 新增采购计划
|
|
|
|
* 新增采购计划
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
// @RepeatSubmit()
|
|
|
|
@RepeatSubmit()
|
|
|
|
// @AuthRuleAnnotation("")
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
// @PostMapping("/purchase/plan/postOrder")
|
|
|
|
@PostMapping("/purchase/plan/postOrder")
|
|
|
|
// public BaseResponse postOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
|
|
|
public BaseResponse postOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
|
|
|
//
|
|
|
|
|
|
|
|
// Long userId = customerService.getUserId();
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
// PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
PurPlanEntity purPlanEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
//
|
|
|
|
|
|
|
|
// purApplyEntity.setCreateUser(userId + "");
|
|
|
|
purPlanEntity.setCreateUser(userId + "");
|
|
|
|
// purApplyEntity.setCreateTime(new Date());
|
|
|
|
purPlanEntity.setCreateTime(new Date());
|
|
|
|
// purApplyEntity.setUpdateTime(new Date());
|
|
|
|
purPlanEntity.setUpdateTime(new Date());
|
|
|
|
// purApplyEntity.setStatus(postPurPlanRequest.getEditStatus()); //草稿状态
|
|
|
|
purPlanEntity.setUpdateUser(userId + "");
|
|
|
|
// if (purApplyEntity.getId() == null) {
|
|
|
|
purPlanEntity.setStatus(postPurPlanRequest.getEditStatus()); //草稿状态
|
|
|
|
// String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.JH_ORDER, "yyyyMMdd"));
|
|
|
|
|
|
|
|
// purApplyEntity.setBillNo(billNo);
|
|
|
|
if(postPurPlanRequest.getType()!=null){
|
|
|
|
// purPlanService.insert(purApplyEntity);
|
|
|
|
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
|
|
|
|
// } else {
|
|
|
|
purPlanEntity.setBillNo(billNo);
|
|
|
|
// purPlanService.update(purApplyEntity);
|
|
|
|
}
|
|
|
|
// if (CollUtil.isNotEmpty(postPurPlanRequest.getSubErpOrders())) {
|
|
|
|
|
|
|
|
// purPlanDetailService.deleteByOrderId(purApplyEntity.getId() + "");
|
|
|
|
if (purPlanEntity.getId() == null) {
|
|
|
|
// }
|
|
|
|
purPlanService.insert(purPlanEntity);
|
|
|
|
// }
|
|
|
|
} else {
|
|
|
|
// List<PurPlanDetailEntity> purPlanDetailEntities = new ArrayList<>();
|
|
|
|
purPlanService.update(purPlanEntity);
|
|
|
|
// if (CollUtil.isNotEmpty(postPurPlanRequest.getSubErpOrders())) {
|
|
|
|
}
|
|
|
|
// for (StockOrderDetailEntity stockOrderDetailEntity : postPurPlanRequest.getSubErpOrders()) {
|
|
|
|
|
|
|
|
// PurPlanDetailEntity purApplyDetailEntity = new PurPlanDetailEntity();
|
|
|
|
|
|
|
|
// BeanUtils.copyProperties(stockOrderDetailEntity, purApplyDetailEntity);
|
|
|
|
|
|
|
|
// purApplyDetailEntity.setOrderIdFk(purApplyEntity.getId() + "");
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
// purApplyDetailEntity.setCount(Integer.valueOf(stockOrderDetailEntity.getCount()));
|
|
|
|
}
|
|
|
|
// purPlanDetailService.insert(purApplyDetailEntity);
|
|
|
|
|
|
|
|
// purPlanDetailEntities.add(purApplyDetailEntity);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// return ResultVOUtils.success("提交成功!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 查询采购计划列表
|
|
|
|
* 查询采购计划列表
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -137,115 +143,97 @@ public class PurPlanController {
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// /**
|
|
|
|
/**
|
|
|
|
// * 查询采购计划列表
|
|
|
|
* 查询采购计划列表
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
// @GetMapping("/purchase/plan/auditList")
|
|
|
|
@GetMapping("/purchase/plan/auditList")
|
|
|
|
// public BaseResponse auditList(PurPlanRequest purApplyRequest) {
|
|
|
|
public BaseResponse auditList(PurPlanRequest purApplyRequest) {
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (purApplyRequest.getStatus() == null) {
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
// purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
|
|
|
purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
// PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
// pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
// PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
// pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
// return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// /**
|
|
|
|
/**
|
|
|
|
// * 审核采购计划
|
|
|
|
* 审核采购计划
|
|
|
|
// */
|
|
|
|
*/
|
|
|
|
// @RepeatSubmit()
|
|
|
|
@RepeatSubmit()
|
|
|
|
// @PostMapping("/purchase/plan/auditOrder")
|
|
|
|
@PostMapping("/purchase/plan/auditOrder")
|
|
|
|
// public BaseResponse auditOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
|
|
|
public BaseResponse auditOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
|
|
|
// Long userId = customerService.getUserId();
|
|
|
|
Long userId = customerService.getUserId();
|
|
|
|
// PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
// purApplyEntity.setUpdateTime(new Date());
|
|
|
|
purApplyEntity.setUpdateTime(new Date());
|
|
|
|
// purApplyEntity.setAuditUser(userId + "");
|
|
|
|
purApplyEntity.setAuditUser(userId + "");
|
|
|
|
// purApplyEntity.setStatus(postPurPlanRequest.getEditStatus());
|
|
|
|
purApplyEntity.setStatus(postPurPlanRequest.getEditStatus());
|
|
|
|
// purPlanService.update(purApplyEntity);
|
|
|
|
purPlanService.update(purApplyEntity);
|
|
|
|
//
|
|
|
|
|
|
|
|
// List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + "");
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + "");
|
|
|
|
//
|
|
|
|
|
|
|
|
//// BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.findByAction(purApplyEntity.getBillType());
|
|
|
|
if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) {
|
|
|
|
// //转换成业务单据
|
|
|
|
|
|
|
|
// if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED
|
|
|
|
if (CollUtil.isNotEmpty(purPlanDetailEntities) && postPurPlanRequest.isAutoPurchase()==true
|
|
|
|
// && StrUtil.isNotEmpty(purApplyEntity.getTargetSubInv()) && StrUtil.isNotEmpty(purApplyEntity.getTargetBillAction())) {
|
|
|
|
&& StrUtil.isNotEmpty(postPurPlanRequest.getTargetSubInv()) && StrUtil.isNotEmpty(postPurPlanRequest.getTargetBillAction()) ) {
|
|
|
|
//
|
|
|
|
//生产单据表信息
|
|
|
|
// if (CollUtil.isNotEmpty(purPlanDetailEntities)) {
|
|
|
|
IoOrderEntity ioOrderEntity=new IoOrderEntity();
|
|
|
|
// //1.根据供应商分组
|
|
|
|
ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER ,"yyyyMMdd")));
|
|
|
|
// Map<String, List<PurPlanDetailEntity>> filterSupMaps = new HashMap<>();
|
|
|
|
ioOrderEntity.setCorpOrderId(CustomUtil.getDate());
|
|
|
|
// for (PurPlanDetailEntity purPlanDetailEntity : purPlanDetailEntities) {
|
|
|
|
ioOrderEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
// if (StrUtil.isNotEmpty(purPlanDetailEntity.getSupId())) {
|
|
|
|
ioOrderEntity.setAction(postPurPlanRequest.getTargetBillAction());
|
|
|
|
// if (filterSupMaps.get(purPlanDetailEntity.getSupId()) == null) {
|
|
|
|
ioOrderEntity.setFromCorp("1111");
|
|
|
|
// List<PurPlanDetailEntity> temps = new ArrayList<>();
|
|
|
|
ioOrderEntity.setFromType(ConstantStatus.FROM_PLAN);
|
|
|
|
// temps.add(purPlanDetailEntity);
|
|
|
|
ioOrderEntity.setStatus(1);
|
|
|
|
// filterSupMaps.put(purPlanDetailEntity.getSupId(), temps);
|
|
|
|
ioOrderEntity.setDealStatus(1);
|
|
|
|
// } else {
|
|
|
|
ioOrderEntity.setCreateTime(new Date());
|
|
|
|
// filterSupMaps.get(purPlanDetailEntity.getSupId()).add(purPlanDetailEntity);
|
|
|
|
ioOrderEntity.setCreateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser());
|
|
|
|
// }
|
|
|
|
ioOrderEntity.setUpdateTime(new Date());
|
|
|
|
// }
|
|
|
|
ioOrderEntity.setUpdateUser(postPurPlanRequest.getPurPlanEntity().getAuditUser());
|
|
|
|
// }
|
|
|
|
ioOrderEntity.setCustomerId("110");
|
|
|
|
// //2.生成业务单据
|
|
|
|
ioOrderEntity.setDeptCode(postPurPlanRequest.getTargetDeptCode());
|
|
|
|
// String stockOrderNo = ";";
|
|
|
|
ioOrderEntity.setInvCode(postPurPlanRequest.getTargetSubInv());
|
|
|
|
// for (String supId : filterSupMaps.keySet()) {
|
|
|
|
ioOrderService.insertOrder(ioOrderEntity);
|
|
|
|
// //2.构建业务单据
|
|
|
|
//插入业务单表
|
|
|
|
// StockOrderEntity stockOrderEntity = new StockOrderEntity();
|
|
|
|
//查询详情表
|
|
|
|
// String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.BUS_ORDER, "yyyyMMdd"));
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntityList=purPlanDetailService.findByOrderId(postPurPlanRequest.getPurPlanEntity().getId()+"");
|
|
|
|
// stockOrderNo = stockOrderNo + billNo;
|
|
|
|
for (PurPlanDetailEntity obj:purPlanDetailEntityList){
|
|
|
|
// stockOrderEntity.setBillNo(billNo);
|
|
|
|
|
|
|
|
// stockOrderEntity.setSourceType(ConstantStatus.ST_APPLY_ADD);
|
|
|
|
BasicProductsEntity basicProductsEntity=purPlanDetailService.selectIoOrderDetailBiz(obj.getId());
|
|
|
|
// stockOrderEntity.setCorpId(supId);
|
|
|
|
|
|
|
|
// stockOrderEntity.setUnitIdFk(supId);
|
|
|
|
IoOrderDetailBizEntity ioOrderDetailBizEntity=new IoOrderDetailBizEntity();
|
|
|
|
// BasicCorpEntity basicCorpEntity = basicCorpService.selectByErpId(supId);
|
|
|
|
ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getId()+"");
|
|
|
|
// stockOrderEntity.setCorpName(basicCorpEntity.getName());
|
|
|
|
ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId()));
|
|
|
|
// stockOrderEntity.setBilldate(DateUtil.formatDateTime(new Date()));
|
|
|
|
ioOrderDetailBizEntity.setCount(obj.getCount());
|
|
|
|
// stockOrderEntity.setStatus(ConstantStatus.SORDER_ALLOC);
|
|
|
|
ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid());
|
|
|
|
// stockOrderEntity.setBillType(purApplyEntity.getTargetBillAction());
|
|
|
|
ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode());
|
|
|
|
// stockOrderEntity.setInvWarehouseCode(purApplyEntity.getTargetSubInv());
|
|
|
|
ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc());
|
|
|
|
// stockOrderEntity.setLocStorageCode(purApplyEntity.getTargetInv());
|
|
|
|
ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh());
|
|
|
|
// stockOrderEntity.setCreateUser(userId);
|
|
|
|
ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc());
|
|
|
|
//// stockOrderEntity.setDept(purApplyEntity.getDeptCode());
|
|
|
|
ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory());
|
|
|
|
// stockOrderService.insertStockOrder(stockOrderEntity);
|
|
|
|
ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname());
|
|
|
|
// //3.构建单据详情
|
|
|
|
ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh());
|
|
|
|
// List<PurPlanDetailEntity> temps = filterSupMaps.get(supId);
|
|
|
|
if(basicProductsEntity.getPrice()!=null) {
|
|
|
|
// if (CollUtil.isNotEmpty(temps)) {
|
|
|
|
ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice()));
|
|
|
|
// List<StockOrderDetailEntity> stockOrderDetailEntities = new ArrayList<>();
|
|
|
|
}
|
|
|
|
// for (PurPlanDetailEntity purPlanDetailEntity : temps) {
|
|
|
|
ioOrderDetailBizEntity.setSupId(obj.getSupId());
|
|
|
|
// StockOrderDetailEntity stockOrderDetailEntity = new StockOrderDetailEntity();
|
|
|
|
ioOrderDetailBizService.insert(ioOrderDetailBizEntity);
|
|
|
|
// UdiRelevanceResponse udiRelevanceEntity = udiRelevanceService.selectGroupById(purPlanDetailEntity.getProductId());
|
|
|
|
}
|
|
|
|
// stockOrderDetailEntity.setProductName(udiRelevanceEntity.getCpmctymc());
|
|
|
|
|
|
|
|
// stockOrderDetailEntity.setRelId(udiRelevanceEntity.getId() + "");
|
|
|
|
purApplyEntity.setStockOrderNo(ioOrderEntity.getBillNo());
|
|
|
|
// stockOrderDetailEntity.setProductId(udiRelevanceEntity.getId() + "");
|
|
|
|
purPlanService.update(purApplyEntity);
|
|
|
|
// stockOrderDetailEntity.setSpec(udiRelevanceEntity.getGgxh());
|
|
|
|
}
|
|
|
|
// stockOrderDetailEntity.setCount(purPlanDetailEntity.getCount());
|
|
|
|
}
|
|
|
|
// stockOrderDetailEntity.setReCount(purPlanDetailEntity.getCount());
|
|
|
|
return ResultVOUtils.success("更新成功!");
|
|
|
|
// 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("更新成功!");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
// /**
|
|
|
@ -270,21 +258,21 @@ public class PurPlanController {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//// /**
|
|
|
|
/**
|
|
|
|
//// * 查询采购计划列表
|
|
|
|
* 查询采购计划列表
|
|
|
|
//// */
|
|
|
|
*/
|
|
|
|
//// @GetMapping("/purchase/plan/list/detail")
|
|
|
|
@GetMapping("/purchase/plan/list/detail")
|
|
|
|
//// public BaseResponse detailList(PurPlanDetailRequest purApplyDetailRequest) {
|
|
|
|
public BaseResponse detailList(PurPlanDetailRequest purApplyDetailRequest) {
|
|
|
|
////
|
|
|
|
|
|
|
|
//// List<StockOrderDetailEntity> purApplyDetailEntities = purPlanDetailService.joinQueryList(purApplyDetailRequest);
|
|
|
|
List<PurOrderDetailResponse> purApplyDetailEntities = purPlanDetailService.joinQueryList(purApplyDetailRequest);
|
|
|
|
//// PageInfo<StockOrderDetailEntity> pageInfo;
|
|
|
|
PageInfo<PurOrderDetailResponse> pageInfo;
|
|
|
|
//// pageInfo = new PageInfo<>(purApplyDetailEntities);
|
|
|
|
pageInfo = new PageInfo<>(purApplyDetailEntities);
|
|
|
|
//// PageSimpleResponse<StockOrderDetailEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
PageSimpleResponse<PurOrderDetailResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
//// pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
//// pageSimpleResponse.setList(purApplyDetailEntities);
|
|
|
|
pageSimpleResponse.setList(purApplyDetailEntities);
|
|
|
|
//// return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
////
|
|
|
|
|
|
|
|
//// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// /**
|
|
|
|
// /**
|
|
|
@ -347,16 +335,16 @@ public class PurPlanController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加申购单到采购单里面
|
|
|
|
* 添加申购单到采购单里面
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@PostMapping("/purchase/plan/addPlanDetail")
|
|
|
|
@PostMapping("/purchase/plan/addPlanDetailAndApply")
|
|
|
|
public BaseResponse addPlanDetail(@RequestBody PurPlanRequest purApplyRequest) {
|
|
|
|
public BaseResponse addPlanDetailAndApply(@RequestBody PurPlanRequest purPlanRequest) {
|
|
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getRId() == null && purApplyRequest.getId() == null) {
|
|
|
|
if (purPlanRequest.getApplyId() == null || purPlanRequest.getId() == null) {
|
|
|
|
return ResultVOUtils.error(999,"参数错误!");
|
|
|
|
return ResultVOUtils.error(999,"参数错误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//查询申购单详情
|
|
|
|
//查询申购单详情
|
|
|
|
PurApplyDetailRequest purApplyDetailRequest=new PurApplyDetailRequest();
|
|
|
|
PurApplyDetailRequest purApplyDetailRequest=new PurApplyDetailRequest();
|
|
|
|
purApplyDetailRequest.setOrderIdFk(purApplyRequest.getRId());
|
|
|
|
purApplyDetailRequest.setOrderIdFk(purPlanRequest.getApplyId()+"");
|
|
|
|
List<PurApplyDetailEntity> purApplyDetailEntityList=purApplyDetailService.selectPurApplyDetailList(purApplyDetailRequest);
|
|
|
|
List<PurApplyDetailEntity> purApplyDetailEntityList=purApplyDetailService.selectPurApplyDetailList(purApplyDetailRequest);
|
|
|
|
//使用stream拷贝list
|
|
|
|
//使用stream拷贝list
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntityList = purApplyDetailEntityList.stream()
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntityList = purApplyDetailEntityList.stream()
|
|
|
@ -368,8 +356,32 @@ public class PurPlanController {
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
for (PurPlanDetailEntity obj:purPlanDetailEntityList){
|
|
|
|
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);
|
|
|
|
boolean falg= purPlanDetailService.insertPurPlanDetailEntity(purPlanDetailEntityList);
|
|
|
|
if(falg){
|
|
|
|
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();
|
|
|
|
Long id=purPlanEntity.getId();
|
|
|
|
return ResultVOUtils.success(id);
|
|
|
|
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("修改成功");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|