产品bom下拉框选择接口修改,同时获取三个层次的bom,并初步赋值

This commit is contained in:
hy2250089 2019-12-27 19:59:23 +08:00
parent ab07aed1af
commit 9496e2391d
16 changed files with 330 additions and 38 deletions

View File

@ -17,6 +17,7 @@ public interface ProcessBomMapper extends Mapper<ProcessBom> {
void insertProcessMaterialsBom(List<ProcessMaterialsBom> list);
List<ProcessBom> findListByProductBom(ProcessBomParams params);
List<ProcessBom> findListByProductBomId(ProcessBomParams params);
List<ProcessBomDto> findListByProductNameId(ProcessBomParams params);

View File

@ -14,7 +14,6 @@ public interface ProcessMaterialsBomMapper extends Mapper<ProcessMaterialsBom> {
List<MaterialInfoVo> findMaterilaListByProcessBomId(ProcessBom processBom);
void insertOrUpdate(List<ProcessMaterialsBom> processMaterialsBomList);
List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams);

View File

@ -19,4 +19,6 @@ public interface ProductProcessBomMapper extends Mapper<ProductProcessBom> {
List<ProductProcessBom> findListById(ProductProcessBomParams params);
List<ProductProcessBomVO> findByProductNameAndProductNum(ProductProcessBomParams mtAloneProductProcessBomParams);
ProductProcessBom selectByProdProcBom(ProductProcessBomParams params);
}

View File

@ -66,7 +66,7 @@
LEFT JOIN unit ON matbom.unit_id = unit.unit_id AND matbom.company_id = unit.company_id
<where>
<if test="companyId != null">
AND product.company_id = #{companyId}
AND matbom.company_id = #{companyId}
</if>
<if test="processBomId != null">
AND matbom.process_bom_id = #{processBomId}

View File

@ -72,17 +72,7 @@
<result column="product_annex_code" jdbcType="VARCHAR" property="productAnnexCode" />
</resultMap>
<!-- <select id="findList" parameterType="com.deer.wms.produce.manage.model.ProductProcessBomParams" resultMap="ProPrcessBomDTOResultMap">-->
<!-- SELECT product.product_name, productBom.product_process_name, com.company_name-->
<!-- FROM mt_alone_product_process_bom productBom-->
<!-- LEFT JOIN mt_alone_machining_product product ON product.id = productBom.product_id AND product.company_id = productBom.company_id-->
<!-- LEFT JOIN company com ON productBom.company_id = com.company_id-->
<!-- <where>-->
<!-- <if test="companyId != null">-->
<!-- AND productBom.company_id = #{companyId}-->
<!-- </if>-->
<!-- </where>-->
<!-- </select>-->
<select id="findList" resultMap="ProPrcessBomDTOResultMap">
SELECT *,COUNT(mapb.process_step) process_step
FROM mt_alone_product_process_bom mappb
@ -152,4 +142,18 @@
</if>
</select>
<select id="selectByProdProcBom" parameterType="com.deer.wms.produce.manage.model.ProductProcessBomParams" resultMap="BaseResultMap">
SELECT prodprocbom.id, prodprocbom.product_process_name
FROM mt_alone_product_process_bom prodprocbom
<where>
<if test="productBomId != null">
AND prodprocbom.id = #{productBomId}
</if>
<if test="companyId != null">
AND prodprocbom.company_id = #{companyId}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,20 @@
package com.deer.wms.produce.manage.model;
import java.util.List;
/**
* @Author: hy
* @Date: 2019/12/27 10:51
* @Version 1.0
*/
public class ProcessBomHo extends ProcessBom {
private List<ProcessMaterialsBomVo> procMatBomVoList;
public List<ProcessMaterialsBomVo> getProcMatBomVoList() {
return procMatBomVoList;
}
public void setProcMatBomVoList(List<ProcessMaterialsBomVo> procMatBomVoList) {
this.procMatBomVoList = procMatBomVoList;
}
}

View File

@ -0,0 +1,21 @@
package com.deer.wms.produce.manage.model;
import java.util.List;
/**
* @Author: hy
* @Date: 2019/12/27 18:26
* @Version 1.0
*/
public class ProcessHo extends MtAloneProcessVo{
private List<ProcessMaterialsVo> processMaterialsVoList;
public List<ProcessMaterialsVo> getProcessMaterialsVoList() {
return processMaterialsVoList;
}
public void setProcessMaterialsVoList(List<ProcessMaterialsVo> processMaterialsVoList) {
this.processMaterialsVoList = processMaterialsVoList;
}
}

View File

@ -0,0 +1,40 @@
package com.deer.wms.produce.manage.model;
import java.util.List;
/**
* @Author: hy
* @Date: 2019/12/27 10:48
* @Version 1.0
*/
public class ProductProcessBomHo {
private Integer prodProcBomId;
private String prodProcBomName;
private List<ProcessBomHo> processBomHoList;
public Integer getProdProcBomId() {
return prodProcBomId;
}
public void setProdProcBomId(Integer prodProcBomId) {
this.prodProcBomId = prodProcBomId;
}
public String getProdProcBomName() {
return prodProcBomName;
}
public void setProdProcBomName(String prodProcBomName) {
this.prodProcBomName = prodProcBomName;
}
public List<ProcessBomHo> getProcessBomHoList() {
return processBomHoList;
}
public void setProcessBomHoList(List<ProcessBomHo> processBomHoList) {
this.processBomHoList = processBomHoList;
}
}

View File

@ -15,7 +15,7 @@ public class ProductProcessBomParams extends QueryParams {
*/
private Integer productId;
private String productBomId;
private Integer productBomId;
private String productName;
@ -141,11 +141,11 @@ public class ProductProcessBomParams extends QueryParams {
this.productId = productId;
}
public String getProductBomId() {
public Integer getProductBomId() {
return productBomId;
}
public void setProductBomId(String productBomId) {
public void setProductBomId(Integer productBomId) {
this.productBomId = productBomId;
}
}

View File

@ -0,0 +1,20 @@
package com.deer.wms.produce.manage.model;
import java.util.List;
/**
* @Author: hy
* @Date: 2019/12/27 15:33
* @Version 1.0
*/
public class ProductProcessHo extends ProductProcess{
private List<ProcessHo> processHoList;
public List<ProcessHo> getProcessHoList() {
return processHoList;
}
public void setProcessHoList(List<ProcessHo> processHoList) {
this.processHoList = processHoList;
}
}

View File

@ -1,9 +1,6 @@
package com.deer.wms.produce.manage.service;
import com.deer.wms.produce.manage.model.ProductProcessBom;
import com.deer.wms.produce.manage.model.ProductProcessBomDto;
import com.deer.wms.produce.manage.model.ProductProcessBomParams;
import com.deer.wms.produce.manage.model.ProductProcessBomVO;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.project.seed.core.service.Service;
import java.util.List;
@ -23,6 +20,8 @@ public interface ProductProcessBomService extends Service<ProductProcessBom, Int
void addProductProcessBom(ProductProcessBomParams params);
void updateProductProcessBom(ProductProcessBomParams params);
//static Integer getProductBomIdByProductId() {
//}
ProductProcessBomHo findAllBomByProdProcBom(ProductProcessBomParams params);
ProductProcessBom selectByProdProcBom(ProductProcessBomParams params);
}

View File

@ -1,10 +1,7 @@
package com.deer.wms.produce.manage.service;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.ProductAndProcess;
import com.deer.wms.produce.manage.model.ProductProcess;
import com.deer.wms.produce.manage.model.ProductProcessParams;
import com.deer.wms.produce.manage.model.ProductProcessVo;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.project.seed.core.service.Service;
import java.util.List;
@ -20,4 +17,8 @@ public interface ProductProcessService extends Service<ProductProcess, Integer>
void saveProdAndProc(ProductAndProcess productAndProcess, CurrentUser currentUser);
ProductAndProcess queryProductProcessDetail(ProductProcessParams params);
void saveInitial(ProductProcessHo productProcessHo, CurrentUser currentUser);
ProductProcessHo initialProdProcByProdProcBom(ProductProcessBomParams params);
}

View File

@ -4,10 +4,12 @@ import com.deer.wms.produce.manage.dao.ProcessBomMapper;
import com.deer.wms.produce.manage.dao.ProcessMaterialsBomMapper;
import com.deer.wms.produce.manage.dao.ProductProcessBomMapper;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.produce.manage.service.ProcessMaterialsBomService;
import com.deer.wms.produce.manage.service.ProductProcessBomService;
import com.deer.wms.project.seed.core.service.AbstractService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -32,6 +34,9 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
@Autowired
private ProcessMaterialsBomMapper processMaterialsBomMapper;
@Autowired
private ProcessMaterialsBomService processMaterialsBomService;
@Override
public List<ProductProcessBomDto> findProBomAndProList(ProductProcessBomParams params) {
@ -134,4 +139,41 @@ public class ProductProcessBomServiceImpl extends AbstractService<ProductProcess
}
processMaterialsBomMapper.insertOrUpdate(processMaterialsBomList);
}
@Override
public ProductProcessBomHo findAllBomByProdProcBom(ProductProcessBomParams params) {
ProductProcessBomHo productProcessBomHo = new ProductProcessBomHo();
//产品bom的id名称获取
ProductProcessBom productProcessBom = productProcessBomMapper.selectByProdProcBom(params);
productProcessBomHo.setProdProcBomId(productProcessBom.getId());
productProcessBomHo.setProdProcBomName(productProcessBom.getProductProcessName());
//工序bom获取
ProcessBomParams processBomParams = new ProcessBomParams();
processBomParams.setProductProcessId(params.getProductBomId());
processBomParams.setCompanyId(params.getCompanyId());
List<ProcessBom> processBomList = processBomMapper.findListByProductBom(processBomParams);
List<ProcessBomHo> processBomHoList = null;
if(null != processBomList){
processBomHoList = new ArrayList<ProcessBomHo>(processBomList.size());
for(ProcessBom processBom : processBomList){
ProcessBomHo processBomHo = new ProcessBomHo();
BeanUtils.copyProperties(processBom, processBomHo);
processBomHoList.add(processBomHo);
//物料bom获取
ProcessMaterialsBomParams procMatBomParams = new ProcessMaterialsBomParams();
procMatBomParams.setProcessBomId(processBom.getId());
procMatBomParams.setCompanyId(processBomParams.getCompanyId());
List<ProcessMaterialsBomVo> procMatBomVoList = processMaterialsBomService.findProcMatBomVoListByProcBom(procMatBomParams);
processBomHo.setProcMatBomVoList(procMatBomVoList);
}
}
productProcessBomHo.setProcessBomHoList(processBomHoList);
return productProcessBomHo;
}
@Override
public ProductProcessBom selectByProdProcBom(ProductProcessBomParams params) {
return productProcessBomMapper.selectByProdProcBom(params);
}
}

View File

@ -5,9 +5,7 @@ import com.deer.wms.produce.manage.constant.ProduceManageConstant;
import com.deer.wms.produce.manage.constant.ProduceManagePublicMethod;
import com.deer.wms.produce.manage.dao.ProductProcessMapper;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.produce.manage.service.MtAloneProcessService;
import com.deer.wms.produce.manage.service.ProcessBomService;
import com.deer.wms.produce.manage.service.ProductProcessService;
import com.deer.wms.produce.manage.service.*;
import com.deer.wms.project.seed.core.service.AbstractService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -37,6 +35,12 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
@Autowired
private MtAloneProcessService processService;
@Autowired
private ProductProcessBomService productProcessBomService;
@Autowired
private ProcessMaterialsBomService processMaterialsBomService;
@Override
public List<ProductProcessVo> findList(ProductProcessParams params) {
return productProcessMapper.findList(params);
@ -110,4 +114,87 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
return productAndProcess;
}
@Override
public void saveInitial(ProductProcessHo productProcessHo, CurrentUser currentUser) {
//ProductProcess productProcessHo = new ProductProcessHo();
//新增批次产品加工单信息多数变量由前端赋值
// Date date = new Date();
// productProcess.setOperatorId(currentUser.getUserId());
// productProcess.setCreateTime(date);
// productProcess.setUpdateTime(date);
// productProcess.setVersion("1.1");
// productProcess.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
// productProcess.setWorkOrderCode(ProduceManagePublicMethod.creatUniqueCode("PCJGD"));
// productProcess.setShrinkage((productProcess.getDetectionLen()/productProcess.getLen())*100+"%");
// productProcess.setReviewStatus(ProduceManageConstant.REVIEW_STATUS_FORREVIEW);
// productProcess.setCompanyId(currentUser.getCompanyId());
// productProcessMapper.insert(productProcess);
//
// //保存由前端获取的工序信息
// List<MtAloneProcessVo> processVoList = productAndProcess.getProcessVoList();
// if(null != processVoList) {
// List<MtAloneProcess> processList = new ArrayList<MtAloneProcess>(processVoList.size());
// for (MtAloneProcess processVo : processVoList) {
// MtAloneProcess process = new MtAloneProcess();
// BeanUtils.copyProperties(processVo, process);
// process.setProductProcessId(productProcess.getId());
// processList.add(process);
// }
// processService.save(processList);
// }
}
@Override
public ProductProcessHo initialProdProcByProdProcBom(ProductProcessBomParams params) {
ProductProcessHo productProcessHo = new ProductProcessHo();
//批次产品加工单初步赋值关联bom
ProductProcessBom productProcessBom = productProcessBomService.selectByProdProcBom(params);
productProcessHo.setProductBomId(productProcessBom.getId());
productProcessHo.setProductProcessBomName(productProcessBom.getProductProcessName());
//工序初步赋值关联bom
ProcessBomParams processBomParams = new ProcessBomParams();
processBomParams.setProductProcessId(params.getProductBomId());
processBomParams.setCompanyId(params.getCompanyId());
List<ProcessBom> processBomList = processBomService.findListByProductBom(processBomParams);
List<ProcessHo> processHoList;
if(null != processBomList){
processHoList = new ArrayList<ProcessHo>(processBomList.size());
for(ProcessBom processBom : processBomList){
ProcessHo processHo = new ProcessHo();
processHo.setProcessBomId(processBom.getId());
processHo.setProcessBomName(processBom.getProcessName());
processHo.setProcessStep(processBom.getProcessStep());
processHo.setProcessName(processBom.getProcessName());
processHo.setProcessContent(processBom.getProcessContent());
processHo.setSpecification(processBom.getSpecification());
//物料初步赋值关联bom
ProcessMaterialsBomParams procMatBomParams = new ProcessMaterialsBomParams();
procMatBomParams.setProcessBomId(processBom.getId());
procMatBomParams.setCompanyId(processBomParams.getCompanyId());
List<ProcessMaterialsBomVo> procMatBomVoList = processMaterialsBomService.findProcMatBomVoListByProcBom(procMatBomParams);
List<ProcessMaterialsVo> procMatVoList;
if(null != procMatBomVoList){
procMatVoList = new ArrayList<ProcessMaterialsVo>(procMatBomVoList.size());
for (ProcessMaterialsBomVo procMatBomVo : procMatBomVoList){
ProcessMaterialsVo procMatVo = new ProcessMaterialsVo();
procMatVo.setMaterialsBomId(procMatBomVo.getId());
procMatVo.setMaterialsName(procMatBomVo.getMaterialsName());
procMatVo.setSpecification(procMatBomVo.getSpecification());
procMatVo.setUnitId(procMatBomVo.getUnitId());
procMatVo.setUnitName0(procMatBomVo.getUnitName());
procMatVoList.add(procMatVo);
}
processHo.setProcessMaterialsVoList(procMatVoList);
}
processHoList.add(processHo);
}
productProcessHo.setProcessHoList(processHoList);
}
return productProcessHo;
}
}

View File

@ -2,10 +2,7 @@ package com.deer.wms.produce.manage.web;
import com.deer.wms.intercept.annotation.User;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.ProductProcessBom;
import com.deer.wms.produce.manage.model.ProductProcessBomDto;
import com.deer.wms.produce.manage.model.ProductProcessBomParams;
import com.deer.wms.produce.manage.model.ProductProcessBomVO;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.produce.manage.service.ProductProcessBomService;
import com.deer.wms.project.seed.annotation.OperateLog;
import com.deer.wms.project.seed.constant.SystemManageConstant;
@ -183,6 +180,24 @@ public class ProductProcessBomController {
return ResultGenerator.genSuccessResult(pageInfo);
}
/**
* hy暂时没用
* 根据产品bom的id获取产品bom工序bom物料bom信息
* @param params
* @param currentUser
* @return
*/
@GetMapping("/findAllBomByProdProcBom")
public Result findAllBomByProdProcBom(ProductProcessBomParams params, @ApiIgnore @User CurrentUser currentUser) {
if(currentUser==null){
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
}
params.setCompanyId(currentUser.getCompanyId());
ProductProcessBomHo productProcessBomHo = productProcessBomService.findAllBomByProdProcBom(params);
return ResultGenerator.genSuccessResult(productProcessBomHo);
}
/**
* author:caixiang
*

View File

@ -3,10 +3,7 @@ package com.deer.wms.produce.manage.web;
import com.deer.wms.intercept.annotation.Authority;
import com.deer.wms.intercept.annotation.User;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.ProductAndProcess;
import com.deer.wms.produce.manage.model.ProductProcess;
import com.deer.wms.produce.manage.model.ProductProcessParams;
import com.deer.wms.produce.manage.model.ProductProcessVo;
import com.deer.wms.produce.manage.model.*;
import com.deer.wms.produce.manage.service.ProcessBomService;
import com.deer.wms.produce.manage.service.ProductProcessService;
import com.deer.wms.project.seed.annotation.OperateLog;
@ -111,7 +108,7 @@ public class ProductProcessController {
}
/**
* hy正在
* hy
* 新建批次产品加工完毕时点击提交同时保存产品加工和工序信息
* @param productAndProcess
* @param currentUser
@ -159,4 +156,48 @@ public class ProductProcessController {
return ResultGenerator.genSuccessResult(productAndProcess);
}
/**
* hy正在用
* 新建批次产品加工时选择产品bom后
* 生成加工单工序物料信息并对其初步赋值用于表格展示
* @param
* @param currentUser
* @return
*/
@GetMapping("/initialProdProcByProdProcBom")
public Result initialProdProcByProdProcBom(ProductProcessBomParams params, @ApiIgnore @User CurrentUser currentUser) {
//if(currentUser==null){
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
//}
params.setCompanyId(1);
ProductProcessHo productProcessHo = productProcessService.initialProdProcByProdProcBom(params);
return ResultGenerator.genSuccessResult(productProcessHo);
}
/**
* hy正在用
* 首次新建批次产品加工时点击提交初步根据bom对加工单工序物料信息赋值并保存
* @param
* @param currentUser
* @return
*/
//@ApiOperation(value = "批次生产加工初步保存", notes = "批次生产加工初步保存")
//@ApiImplicitParams({
// @ApiImplicitParam(name = "productAndProcess", value = "批次生产加工信息", paramType = "body", dataType = "ProductAndProcess", required = true)
//})
//@OperateLog(description = "批次生产加工初步保存", type = "保存")
//@GetMapping("/findAllBomByProdProcBom")
//public Result findAllBomByProdProcBom(ProductProcessBomParams params, @ApiIgnore @User CurrentUser currentUser) {
// if(currentUser==null){
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
// }
//
// params.setCompanyId(currentUser.getCompanyId());
// ProductProcessBomHo productProcessBomHo = productProcessBomService.findAllBomByProdProcBom(params);
// return ResultGenerator.genSuccessResult(productProcessBomHo);
//}
}