|
|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.zbkj.modules.autogencode.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
@ -8,6 +9,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.zbkj.common.request.PageParamRequest;
|
|
|
|
|
import com.zbkj.common.response.CommonResult;
|
|
|
|
|
import com.zbkj.common.page.CommonPage;
|
|
|
|
|
import com.zbkj.modules.autogencode.entity.CmCustProduct;
|
|
|
|
|
import com.zbkj.modules.autogencode.service.CmCustProductService;
|
|
|
|
|
import com.zbkj.modules.autogencode.entity.PmCanteenPurchaseDetail;
|
|
|
|
|
import com.zbkj.modules.autogencode.service.PmCanteenPurchaseDetailService;
|
|
|
|
|
import com.zbkj.modules.autogencode.entity.PmCanteenPurchasePlan;
|
|
|
|
|
import com.zbkj.modules.autogencode.service.PmCanteenPurchasePlanService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@ -32,7 +39,12 @@ import com.zbkj.modules.autogencode.service.PmCanteenPlanOrderRelService;
|
|
|
|
|
public class PmCanteenPlanOrderRelController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private PmCanteenPlanOrderRelService pmCanteenPlanOrderRelService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CmCustProductService cmCustProductService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private PmCanteenPurchaseDetailService pmCanteenPurchaseDetailService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private PmCanteenPurchasePlanService pmCanteenPurchasePlanService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -137,8 +149,48 @@ public class PmCanteenPlanOrderRelController {
|
|
|
|
|
|
|
|
|
|
// 应用搜索条件
|
|
|
|
|
condition(queryWrapper, request);
|
|
|
|
|
|
|
|
|
|
CommonPage<PmCanteenPlanOrderRel> page = CommonPage.restPage(pmCanteenPlanOrderRelService.pageList(queryWrapper, pageParamRequest));
|
|
|
|
|
List<PmCanteenPlanOrderRel> pmCanteenPlanOrderRels = pmCanteenPlanOrderRelService.pageList(queryWrapper, pageParamRequest);
|
|
|
|
|
if (null != pmCanteenPlanOrderRels && pmCanteenPlanOrderRels.size() > 0 ) {
|
|
|
|
|
for (PmCanteenPlanOrderRel rel : pmCanteenPlanOrderRels) {
|
|
|
|
|
// 如果有detailId,查询PmCanteenPurchaseDetail进行字段赋值
|
|
|
|
|
if (rel.getDetailId() != null) {
|
|
|
|
|
PmCanteenPurchaseDetail detail = pmCanteenPurchaseDetailService.getById(rel.getDetailId());
|
|
|
|
|
if (detail != null) {
|
|
|
|
|
// 从采购明细表中获取字段值 还要有计划编号
|
|
|
|
|
rel.setGoodsId(detail.getGoodsId());
|
|
|
|
|
rel.setGoodsName(detail.getGoodsName());
|
|
|
|
|
rel.setGoodsCode(detail.getGoodsCode());
|
|
|
|
|
rel.setSpec(detail.getSpec());
|
|
|
|
|
rel.setUnit(detail.getUnit());
|
|
|
|
|
rel.setSupplierId(detail.getCustId());
|
|
|
|
|
rel.setSupplierName(detail.getCustName());
|
|
|
|
|
|
|
|
|
|
// 查询计划编号
|
|
|
|
|
if (detail.getPlanId() != null) {
|
|
|
|
|
PmCanteenPurchasePlan plan = pmCanteenPurchasePlanService.getById(detail.getPlanId());
|
|
|
|
|
if (plan != null) {
|
|
|
|
|
rel.setPlanNo(plan.getPlanNo());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (rel.getGoodsId() != null) {
|
|
|
|
|
// 从商品表中查询商品信息
|
|
|
|
|
CmCustProduct goodsDetail = cmCustProductService.getById(rel.getGoodsId());
|
|
|
|
|
if (goodsDetail != null) {
|
|
|
|
|
rel.setGoodsCode(goodsDetail.getGoodsCode());
|
|
|
|
|
rel.setSpec(goodsDetail.getSpec());
|
|
|
|
|
rel.setUnit(goodsDetail.getUnit());
|
|
|
|
|
rel.setSupplierId(goodsDetail.getCustId());
|
|
|
|
|
rel.setSupplierName(goodsDetail.getCustName());
|
|
|
|
|
rel.setGoodsName(goodsDetail.getGoodsName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CommonPage<PmCanteenPlanOrderRel> page = CommonPage.restPage(pmCanteenPlanOrderRels);
|
|
|
|
|
return CommonResult.success(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|