diff --git a/src/main/java/com/glxp/api/constant/ConstantStatus.java b/src/main/java/com/glxp/api/constant/ConstantStatus.java index 5133852cb..65db1c670 100644 --- a/src/main/java/com/glxp/api/constant/ConstantStatus.java +++ b/src/main/java/com/glxp/api/constant/ConstantStatus.java @@ -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类型 diff --git a/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java b/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java index f283dab14..5a66ffae9 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java @@ -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") diff --git a/src/main/java/com/glxp/api/controller/purchase/PurPlanController.java b/src/main/java/com/glxp/api/controller/purchase/PurPlanController.java index 2e2dea4dc..c9246f3e3 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurPlanController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurPlanController.java @@ -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 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 purApplyEntities = purPlanService.queryPageList(purApplyRequest); -// PageInfo pageInfo; -// pageInfo = new PageInfo<>(purApplyEntities); -// PageSimpleResponse 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 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> filterSupMaps = new HashMap<>(); -// for (PurPlanDetailEntity purPlanDetailEntity : purPlanDetailEntities) { -// if (StrUtil.isNotEmpty(purPlanDetailEntity.getSupId())) { -// if (filterSupMaps.get(purPlanDetailEntity.getSupId()) == null) { -// List 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 temps = filterSupMaps.get(supId); -// if (CollUtil.isNotEmpty(temps)) { -// List 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 purApplyEntities = purPlanService.queryPageList(purApplyRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(purApplyEntities); + PageSimpleResponse 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 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 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 purApplyDetailEntities = purPlanDetailService.joinQueryList(purApplyDetailRequest); -//// PageInfo pageInfo; -//// pageInfo = new PageInfo<>(purApplyDetailEntities); -//// PageSimpleResponse 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 purApplyDetailEntities = purPlanDetailService.joinQueryList(purApplyDetailRequest); + PageInfo pageInfo; + pageInfo = new PageInfo<>(purApplyDetailEntities); + PageSimpleResponse 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 purApplyDetailEntityList=purApplyDetailService.selectPurApplyDetailList(purApplyDetailRequest); //使用stream拷贝list List 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 purApplyDetailEntities=purPlanDetailService.getPurPlanDetailEntityList(purPlanDetailRequest); + + + List 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("修改成功"); + } + } diff --git a/src/main/java/com/glxp/api/dao/purchase/PurPlanDao.java b/src/main/java/com/glxp/api/dao/purchase/PurPlanDao.java index 9f9eefd3f..6bfffbddb 100644 --- a/src/main/java/com/glxp/api/dao/purchase/PurPlanDao.java +++ b/src/main/java/com/glxp/api/dao/purchase/PurPlanDao.java @@ -20,4 +20,6 @@ public interface PurPlanDao { Boolean deleteByIds(@Param("ids") List ids); + Boolean deleteById(@Param("id") long id); + } diff --git a/src/main/java/com/glxp/api/dao/purchase/PurPlanDetailDao.java b/src/main/java/com/glxp/api/dao/purchase/PurPlanDetailDao.java index 91ade1187..0891cbdde 100644 --- a/src/main/java/com/glxp/api/dao/purchase/PurPlanDetailDao.java +++ b/src/main/java/com/glxp/api/dao/purchase/PurPlanDetailDao.java @@ -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 queryPageList(PurPlanDetailRequest purApplyRequest); -// List joinQueryList(PurPlanDetailRequest purPlanDetailRequest); + List joinQueryList(PurPlanDetailRequest purPlanDetailRequest); Boolean insert(PurPlanDetailEntity purPlanDetailRequest); @@ -25,4 +28,6 @@ public interface PurPlanDetailDao { boolean insertPurPlanDetailEntity(@Param("datas") List purPlanDetailEntityList); + BasicProductsEntity selectIoOrderDetailBiz(@Param("id") long id); + } diff --git a/src/main/java/com/glxp/api/req/purchase/PostPurPlanRequest.java b/src/main/java/com/glxp/api/req/purchase/PostPurPlanRequest.java index 1e527e050..a236719c1 100644 --- a/src/main/java/com/glxp/api/req/purchase/PostPurPlanRequest.java +++ b/src/main/java/com/glxp/api/req/purchase/PostPurPlanRequest.java @@ -14,5 +14,11 @@ public class PostPurPlanRequest { PurPlanEntity purPlanEntity; List purPlanDetailEntities; // List subErpOrders; + Integer type; + boolean autoPurchase; + String targetSubInv; + String targetBillAction; + String targetDeptCode; + } diff --git a/src/main/java/com/glxp/api/req/purchase/PurPlanRequest.java b/src/main/java/com/glxp/api/req/purchase/PurPlanRequest.java index d0fa139d4..a0a4ffc77 100644 --- a/src/main/java/com/glxp/api/req/purchase/PurPlanRequest.java +++ b/src/main/java/com/glxp/api/req/purchase/PurPlanRequest.java @@ -90,7 +90,9 @@ public class PurPlanRequest extends ListPageRequest { private String startDate; private String endDate; - private String rId; + private Long applyId; + + } diff --git a/src/main/java/com/glxp/api/res/purchase/PurPlanResponse.java b/src/main/java/com/glxp/api/res/purchase/PurPlanResponse.java index e352274da..f21d81e0e 100644 --- a/src/main/java/com/glxp/api/res/purchase/PurPlanResponse.java +++ b/src/main/java/com/glxp/api/res/purchase/PurPlanResponse.java @@ -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; //申购人 diff --git a/src/main/java/com/glxp/api/service/purchase/PurPlanDetailService.java b/src/main/java/com/glxp/api/service/purchase/PurPlanDetailService.java index ec799c68c..9055e563c 100644 --- a/src/main/java/com/glxp/api/service/purchase/PurPlanDetailService.java +++ b/src/main/java/com/glxp/api/service/purchase/PurPlanDetailService.java @@ -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 joinQueryList(PurPlanDetailRequest purApplyRequest); + List joinQueryList(PurPlanDetailRequest purApplyRequest); List findByOrderId(String orderId); List queryPageList(PurPlanDetailRequest purPlanDetailRequest); + List 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 purPlanDetailEntityList); + + BasicProductsEntity selectIoOrderDetailBiz(long id); + } diff --git a/src/main/java/com/glxp/api/service/purchase/PurPlanService.java b/src/main/java/com/glxp/api/service/purchase/PurPlanService.java index 503862453..8a1bd186c 100644 --- a/src/main/java/com/glxp/api/service/purchase/PurPlanService.java +++ b/src/main/java/com/glxp/api/service/purchase/PurPlanService.java @@ -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 ids); + Boolean deleteById(long id); + } diff --git a/src/main/java/com/glxp/api/service/purchase/impl/PurPlanDetailServiceImpl.java b/src/main/java/com/glxp/api/service/purchase/impl/PurPlanDetailServiceImpl.java index e47cc7dec..5cb25b734 100644 --- a/src/main/java/com/glxp/api/service/purchase/impl/PurPlanDetailServiceImpl.java +++ b/src/main/java/com/glxp/api/service/purchase/impl/PurPlanDetailServiceImpl.java @@ -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 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 data = purPlanDetailDao.joinQueryList(purApplyRequest); -// return data; -// } + @Override + public List 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 data = purPlanDetailDao.joinQueryList(purApplyRequest); + return data; + } @Override public List findByOrderId(String orderId) { @@ -51,6 +54,11 @@ public class PurPlanDetailServiceImpl implements PurPlanDetailService { return data; } + @Override + public List 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 purPlanDetailEntityList) { return purPlanDetailDao.insertPurPlanDetailEntity(purPlanDetailEntityList); } + + @Override + public BasicProductsEntity selectIoOrderDetailBiz(long id) { + return purPlanDetailDao.selectIoOrderDetailBiz(id); + } } diff --git a/src/main/java/com/glxp/api/service/purchase/impl/PurPlanServiceImpl.java b/src/main/java/com/glxp/api/service/purchase/impl/PurPlanServiceImpl.java index 7331bec4d..5e83afcfa 100644 --- a/src/main/java/com/glxp/api/service/purchase/impl/PurPlanServiceImpl.java +++ b/src/main/java/com/glxp/api/service/purchase/impl/PurPlanServiceImpl.java @@ -45,4 +45,9 @@ public class PurPlanServiceImpl implements PurPlanService { public Boolean deleteByIds(List ids) { return purPlanDao.deleteByIds(ids); } + + @Override + public Boolean deleteById(long id) { + return purPlanDao.deleteById(id); + } } diff --git a/src/main/java/com/glxp/api/util/CustomUtil.java b/src/main/java/com/glxp/api/util/CustomUtil.java index 409111f95..2899e0551 100644 --- a/src/main/java/com/glxp/api/util/CustomUtil.java +++ b/src/main/java/com/glxp/api/util/CustomUtil.java @@ -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; + } } diff --git a/src/main/resources/mybatis/mapper/purchase/PurPlanDao.xml b/src/main/resources/mybatis/mapper/purchase/PurPlanDao.xml index 2d15cc6e1..b0f47b4cf 100644 --- a/src/main/resources/mybatis/mapper/purchase/PurPlanDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/PurPlanDao.xml @@ -111,6 +111,7 @@ createUser=#{createUser}, createTime=#{createTime}, updateTime=#{updateTime}, + updateUser=#{updateUser}, auditRemark=#{auditRemark}, applyCreateUser=#{applyCreateUser}, applyAuditUser=#{applyAuditUser}, @@ -121,4 +122,9 @@ WHERE id = #{id} + + DELETE FROM pur_plan + WHERE id = #{id} + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/purchase/PurPlanDetailDao.xml b/src/main/resources/mybatis/mapper/purchase/PurPlanDetailDao.xml index 01c3e0201..098133c3d 100644 --- a/src/main/resources/mybatis/mapper/purchase/PurPlanDetailDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/PurPlanDetailDao.xml @@ -21,30 +21,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + \ No newline at end of file