|
|
|
@ -7,10 +7,7 @@ import com.glxp.api.admin.annotation.AuthRuleAnnotation;
|
|
|
|
|
import com.glxp.api.admin.annotation.RepeatSubmit;
|
|
|
|
|
import com.glxp.api.admin.constant.Constant;
|
|
|
|
|
import com.glxp.api.admin.constant.ConstantStatus;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BussinessLocalTypeEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.BussinessTypeEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.UdiRelevanceEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.basic.*;
|
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderDetailEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.business.StockOrderEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.WarehouseEntity;
|
|
|
|
@ -23,10 +20,12 @@ import com.glxp.api.admin.res.PageSimpleResponse;
|
|
|
|
|
import com.glxp.api.admin.res.basic.UdiRelevanceResponse;
|
|
|
|
|
import com.glxp.api.admin.res.purchase.PurPlanResponse;
|
|
|
|
|
import com.glxp.api.admin.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BasicBusTypeChangeService;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BasicUnitMaintainService;
|
|
|
|
|
import com.glxp.api.admin.service.basic.BussinessLocalTypeService;
|
|
|
|
|
import com.glxp.api.admin.service.basic.UdiRelevanceService;
|
|
|
|
|
import com.glxp.api.admin.service.business.StockOrderDetailService;
|
|
|
|
|
import com.glxp.api.admin.service.business.StockOrderService;
|
|
|
|
|
import com.glxp.api.admin.service.purchase.IPurPlanDetailService;
|
|
|
|
|
import com.glxp.api.admin.service.purchase.IPurPlanService;
|
|
|
|
|
import com.glxp.api.admin.util.DateUtil;
|
|
|
|
@ -68,11 +67,13 @@ public class PurPlanController {
|
|
|
|
|
@Resource
|
|
|
|
|
BasicUnitMaintainService basicUnitMaintainService;
|
|
|
|
|
@Resource
|
|
|
|
|
BussinessLocalTypeService bussinessLocalTypeService;
|
|
|
|
|
@Resource
|
|
|
|
|
UdiRelevanceService udiRelevanceService;
|
|
|
|
|
@Resource
|
|
|
|
|
StockOrderDetailService stockOrderDetailService;
|
|
|
|
|
@Resource
|
|
|
|
|
BasicBusTypeChangeService basicBusTypeChangeService;
|
|
|
|
|
@Resource
|
|
|
|
|
StockOrderService stockOrderService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增采购计划
|
|
|
|
@ -84,6 +85,7 @@ public class PurPlanController {
|
|
|
|
|
|
|
|
|
|
Integer userId = customerService.getUserId();
|
|
|
|
|
PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
|
|
|
|
|
|
purApplyEntity.setCreateBy(userId + "");
|
|
|
|
|
purApplyEntity.setCreateTime(new Date());
|
|
|
|
|
purApplyEntity.setUpdateTime(new Date());
|
|
|
|
@ -110,6 +112,66 @@ public class PurPlanController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询采购计划列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/purchase/plan/list")
|
|
|
|
|
public BaseResponse list(PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
|
purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询采购计划列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/purchase/plan/auditList")
|
|
|
|
|
public BaseResponse auditList(PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
|
purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
|
|
|
|
}
|
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 审核采购计划
|
|
|
|
|
*/
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@PostMapping("/purchase/plan/auditOrder")
|
|
|
|
|
public BaseResponse auditOrder(@RequestBody PostPurPlanRequest postPurPlanRequest) {
|
|
|
|
|
Integer userId = customerService.getUserId();
|
|
|
|
|
PurPlanEntity purApplyEntity = postPurPlanRequest.getPurPlanEntity();
|
|
|
|
|
purApplyEntity.setUpdateTime(new Date());
|
|
|
|
|
purApplyEntity.setAuditBy(userId + "");
|
|
|
|
|
purApplyEntity.setStatus(postPurPlanRequest.getEditStatus());
|
|
|
|
|
purPlanService.update(purApplyEntity);
|
|
|
|
|
|
|
|
|
|
List<PurPlanDetailEntity> purPlanDetailEntities = purPlanDetailService.findByOrderId(purApplyEntity.getId() + "");
|
|
|
|
|
|
|
|
|
|
//转换成业务单据
|
|
|
|
|
if (postPurPlanRequest.getEditStatus() == ConstantStatus.APPLY_AUDIT_ED) {
|
|
|
|
|
|
|
|
|
@ -143,18 +205,17 @@ public class PurPlanController {
|
|
|
|
|
stockOrderEntity.setBilldate(DateUtil.formatDateTime(new Date()));
|
|
|
|
|
stockOrderEntity.setStatus(ConstantStatus.SORDER_ALLOC);
|
|
|
|
|
//todo
|
|
|
|
|
BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByName("采购入库单");
|
|
|
|
|
stockOrderEntity.setBillType(bussinessLocalTypeEntity.getLocalAction());
|
|
|
|
|
BasicBusTypeChangeEntity basicBusTypeChangeEntity = basicBusTypeChangeService.findByAction("purplan");
|
|
|
|
|
stockOrderEntity.setBillType(basicBusTypeChangeEntity.getTargetBusAction());
|
|
|
|
|
stockOrderEntity.setInvWarehouseCode(purApplyEntity.getInvWarehouseCode());
|
|
|
|
|
stockOrderEntity.setLocStorageCode(purApplyEntity.getLocStorageCode());
|
|
|
|
|
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());
|
|
|
|
@ -169,7 +230,6 @@ public class PurPlanController {
|
|
|
|
|
stockOrderDetailEntity.setMeasname(udiRelevanceEntity.getMeasname());
|
|
|
|
|
stockOrderDetailEntity.setOrderIdFk(stockOrderEntity.getId());
|
|
|
|
|
stockOrderDetailEntities.add(stockOrderDetailEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (CollUtil.isNotEmpty(stockOrderDetailEntities)) {
|
|
|
|
|
stockOrderDetailService.insertStockOrderDetails(stockOrderDetailEntities);
|
|
|
|
@ -180,61 +240,7 @@ public class PurPlanController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("提交成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询采购计划列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/purchase/plan/list")
|
|
|
|
|
public BaseResponse list(PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
|
purApplyRequest.setStatus(11); //查询未审核和草稿状态
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询采购计划列表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/purchase/plan/auditList")
|
|
|
|
|
public BaseResponse auditList(PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
if (purApplyRequest.getStatus() == null) {
|
|
|
|
|
purApplyRequest.setStatus(10); //查询未审核和已审核状态
|
|
|
|
|
}
|
|
|
|
|
List<PurPlanResponse> purApplyEntities = purPlanService.queryPageList(purApplyRequest);
|
|
|
|
|
PageInfo<PurPlanResponse> pageInfo;
|
|
|
|
|
pageInfo = new PageInfo<>(purApplyEntities);
|
|
|
|
|
PageSimpleResponse<PurPlanResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
|
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
|
|
|
pageSimpleResponse.setList(purApplyEntities);
|
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 审核采购计划
|
|
|
|
|
*/
|
|
|
|
|
@RepeatSubmit()
|
|
|
|
|
@PostMapping("/purchase/plan/auditOrder")
|
|
|
|
|
public BaseResponse auditOrder(@RequestBody PurPlanRequest purApplyRequest) {
|
|
|
|
|
|
|
|
|
|
PurPlanEntity purApplyEntity = new PurPlanEntity();
|
|
|
|
|
BeanUtils.copyProperties(purApplyRequest, purApplyEntity);
|
|
|
|
|
purPlanService.update(purApplyEntity);
|
|
|
|
|
return ResultVOUtils.success("更新成功!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|