查询工序详情、保存工序及物料修改

This commit is contained in:
hy2250089 2019-12-26 21:20:09 +08:00
parent 994c8ce18d
commit ab07aed1af
13 changed files with 120 additions and 54 deletions

View File

@ -17,4 +17,5 @@ public interface ProcessMaterialsBomMapper extends Mapper<ProcessMaterialsBom> {
void insertOrUpdate(List<ProcessMaterialsBom> processMaterialsBomList); void insertOrUpdate(List<ProcessMaterialsBom> processMaterialsBomList);
List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams);
} }

View File

@ -95,7 +95,7 @@
<if test="companyId != null"> <if test="companyId != null">
AND process.company_id = #{companyId} AND process.company_id = #{companyId}
</if> </if>
</where> </where> ORDER BY process.process_step
</select> </select>

View File

@ -60,6 +60,20 @@
</resultMap> </resultMap>
<select id="findProcMatBomVoListByProcBom" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="ProcessMatBomVoResultMap">
SELECT matbom.*, materials.materials_name, unit.unit_name FROM mt_alone_process_materials_bom matbom
LEFT JOIN mt_alone_materials_info materials ON matbom.materials_id = materials.id AND matbom.company_id = materials.company_id
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}
</if>
<if test="processBomId != null">
AND matbom.process_bom_id = #{processBomId}
</if>
</where> ORDER BY matbom.create_time DESC, matbom.update_time DESC
</select>
<select id="findProcMatBomVoListByProId" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="ProcessMatBomVoResultMap"> <select id="findProcMatBomVoListByProId" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="ProcessMatBomVoResultMap">
SELECT materials.code, materials.materials_name, SELECT materials.code, materials.materials_name,
unit.unit_name, matbom.specification, procbom.process_name, unit.unit_name, matbom.specification, procbom.process_name,
@ -82,6 +96,7 @@
</where> </where>
</select> </select>
<select id="findListByProcessBomId" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="BaseResultMap"> <select id="findListByProcessBomId" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="BaseResultMap">
SELECT matbom.* SELECT matbom.*
FROM mt_alone_process_materials_bom matbom FROM mt_alone_process_materials_bom matbom

View File

@ -115,7 +115,7 @@
<if test="companyId != null"> <if test="companyId != null">
AND prodproc.company_id = #{companyId} AND prodproc.company_id = #{companyId}
</if> </if>
</where> </where> ORDER BY prodproc.create_time DESC, prodproc.update_time DESC
</select> </select>
<!--没用 <!--没用

View File

@ -10,6 +10,8 @@ public class MtAloneProcessParams extends QueryParams {
private Integer productBomId; private Integer productBomId;
private Integer processBomId;
public Integer getProcessId() { public Integer getProcessId() {
return processId; return processId;
} }
@ -25,4 +27,12 @@ public class MtAloneProcessParams extends QueryParams {
public void setProductBomId(Integer productBomId) { public void setProductBomId(Integer productBomId) {
this.productBomId = productBomId; this.productBomId = productBomId;
} }
public Integer getProcessBomId() {
return processBomId;
}
public void setProcessBomId(Integer processBomId) {
this.processBomId = processBomId;
}
} }

View File

@ -1,30 +0,0 @@
package com.deer.wms.produce.manage.model;
/**
*同时获取工序信息和物料信息
* @Author: hy
* @Date: 2019/12/19 20:13
* @Version 1.0
*/
public class ProcessAndMaterials {
private MtAloneProcessVo processVo;//工序扩展信息
private ProcessMaterialsVo[] processMaterialsVo;//物料扩展信息
public MtAloneProcessVo getProcessVo() {
return processVo;
}
public void setProcessVo(MtAloneProcessVo processVo) {
this.processVo = processVo;
}
public ProcessMaterialsVo[] getProcessMaterialsVo() {
return processMaterialsVo;
}
public void setProcessMaterialsVo(ProcessMaterialsVo[] processMaterialsVo) {
this.processMaterialsVo = processMaterialsVo;
}
}

View File

@ -0,0 +1,32 @@
package com.deer.wms.produce.manage.model;
import java.util.List;
/**
*同时获取工序信息和物料bom信息
* @Author: hy
* @Date: 2019/12/19 20:13
* @Version 1.0
*/
public class ProcessAndMaterialsBom {
private MtAloneProcessVo processVo;//工序扩展信息
private List<ProcessMaterialsBomVo> procMatBomVoList;//物料扩展信息
public MtAloneProcessVo getProcessVo() {
return processVo;
}
public void setProcessVo(MtAloneProcessVo processVo) {
this.processVo = processVo;
}
public List<ProcessMaterialsBomVo> getProcMatBomVoList() {
return procMatBomVoList;
}
public void setProcMatBomVoList(List<ProcessMaterialsBomVo> procMatBomVoList) {
this.procMatBomVoList = procMatBomVoList;
}
}

View File

@ -23,8 +23,6 @@ public class ProcessMaterialsBomVo extends ProcessMaterialsBom {
private Float remain;//剩余数量 private Float remain;//剩余数量
public String getProcessName() { public String getProcessName() {
return processName; return processName;
} }

View File

@ -14,7 +14,7 @@ public interface MtAloneProcessService extends Service<MtAloneProcess, Integer>
List<MtAloneProcessVo> findProcessVoListByProductProcess(ProductProcessParams params); List<MtAloneProcessVo> findProcessVoListByProductProcess(ProductProcessParams params);
ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params); ProcessAndMaterialsBom queryProcessDetail(MtAloneProcessParams params);
void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser); void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser);

View File

@ -16,6 +16,8 @@ public interface ProcessMaterialsBomService extends Service<ProcessMaterialsBom,
List<MaterialInfoVo> findMaterilaListByProcessBomId(ProcessBom processBom); List<MaterialInfoVo> findMaterilaListByProcessBomId(ProcessBom processBom);
List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams);
//List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) ; //List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) ;

View File

@ -1,10 +1,13 @@
package com.deer.wms.produce.manage.service.impl; package com.deer.wms.produce.manage.service.impl;
import com.deer.wms.intercept.common.data.CurrentUser; import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.constant.ProduceManagePublicMethod;
import com.deer.wms.produce.manage.dao.MtAloneProcessMapper; import com.deer.wms.produce.manage.dao.MtAloneProcessMapper;
import com.deer.wms.produce.manage.dao.ProcessMaterialsMapper;
import com.deer.wms.produce.manage.model.*; import com.deer.wms.produce.manage.model.*;
import com.deer.wms.produce.manage.service.MtAloneProcessService; import com.deer.wms.produce.manage.service.MtAloneProcessService;
import com.deer.wms.produce.manage.service.ProcessBomService; import com.deer.wms.produce.manage.service.ProcessBomService;
import com.deer.wms.produce.manage.service.ProcessMaterialsBomService;
import com.deer.wms.produce.manage.service.ProcessMaterialsService; import com.deer.wms.produce.manage.service.ProcessMaterialsService;
import com.deer.wms.project.seed.core.service.AbstractService; import com.deer.wms.project.seed.core.service.AbstractService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -13,6 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -31,6 +35,9 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
@Autowired @Autowired
private ProcessMaterialsService processMaterialsService; private ProcessMaterialsService processMaterialsService;
@Autowired
private ProcessMaterialsBomService processMaterialsBomService;
@Override @Override
public List<MtAloneProcess> findProcessListByProductBom(ProcessBomParams params) { public List<MtAloneProcess> findProcessListByProductBom(ProcessBomParams params) {
//通过产品bom获取工序bom //通过产品bom获取工序bom
@ -55,25 +62,21 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
} }
@Override @Override
public ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params) { public ProcessAndMaterialsBom queryProcessDetail(MtAloneProcessParams params) {
//根据工序id查询工序详细信息 //根据工序id查询工序详细信息
MtAloneProcessVo processVo = (MtAloneProcessVo) mtAloneProcessMapper.selectProcessVoByProcessId(params); MtAloneProcessVo processVo = (MtAloneProcessVo) mtAloneProcessMapper.selectProcessVoByProcessId(params);
//根据工序id查询物料信息 //根据工序bom的id查询物料bom信息
List<ProcessMaterialsVo> processMaterialsVoList = processMaterialsService.findProcMatVoListByProcess(params); ProcessMaterialsBomParams procMatBomParams = new ProcessMaterialsBomParams();
procMatBomParams.setProcessBomId(processVo.getProcessBomId());
procMatBomParams.setCompanyId(params.getCompanyId());
List<ProcessMaterialsBomVo> procMatBomVoList = processMaterialsBomService.findProcMatBomVoListByProcBom(procMatBomParams);
ProcessAndMaterials processAndMaterials = new ProcessAndMaterials(); ProcessAndMaterialsBom processAndMaterialsBom = new ProcessAndMaterialsBom();
processAndMaterials.setProcessVo(processVo); processAndMaterialsBom.setProcessVo(processVo);
if(null != processMaterialsVoList) { processAndMaterialsBom.setProcMatBomVoList(procMatBomVoList);
ProcessMaterialsVo[] processMaterialsVo = new ProcessMaterialsVo[processMaterialsVoList.size()];
for (int i = 0; i < processMaterialsVo.length; i++) {
processMaterialsVo[i] = processMaterialsVoList.get(i);
}
processAndMaterials.setProcessMaterialsVo(processMaterialsVo);
}
return processAndMaterialsBom;
return processAndMaterials;
} }
@Override @Override
@ -84,7 +87,37 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
BeanUtils.copyProperties(mtAloneProcessVo, mtAloneProcess); BeanUtils.copyProperties(mtAloneProcessVo, mtAloneProcess);
mtAloneProcessMapper.updateByPrimaryKey(mtAloneProcess); mtAloneProcessMapper.updateByPrimaryKey(mtAloneProcess);
//前端对物料用量赋值保存物料 //通过工序bom的id获取物料bom
ProcessMaterialsBomParams procMatBomParams = new ProcessMaterialsBomParams();
procMatBomParams.setProcessBomId(processAndProcMat.getMtAloneProcessVo().getProcessBomId());
procMatBomParams.setCompanyId(currentUser.getCompanyId());
List<ProcessMaterialsBomVo> procMatBomVoList = processMaterialsBomService.findProcMatBomVoListByProcBom(procMatBomParams);
////由物料bom对物料赋值保存物料,其中前端赋值物料用量
//MtAloneProcessParams processParams = new MtAloneProcessParams();
//processParams.setProcessId(mtAloneProcessVo.getId());
//List<ProcessMaterialsVo> procMatVoList = processMaterialsService.findProcMatVoListByProcess(processParams);
//if(null == procMatVoList){
// procMatVoList = new ArrayList<ProcessMaterialsVo>(procMatBomVoList.size());
// Date date = new Date();
// for (ProcessMaterialsBomVo procMatBomVo : procMatBomVoList){
// ProcessMaterialsVo procMatVo = new ProcessMaterialsVo();
// procMatVo.setCreateTime(date);
// procMatVo.setUpdateTime(date);
// procMatVo.setStatus(0);
// procMatVo.setProcessId(mtAloneProcessVo.getId());
// procMatVo.setMaterialsBomId(procMatBomVo.getId());
// procMatVo.setMaterialsName(procMatBomVo.getMaterialsName());
// procMatVo.setCode(ProduceManagePublicMethod.creatUniqueCode("WL"));
// procMatVo.setSpecification(procMatBomVo.getSpecification());
// procMatVo.setUnitId(procMatBomVo.getUnitId());
// procMatVo.setCompanyId(currentUser.getCompanyId());
// procMatVoList.add(procMatVo);
// }
// processMaterialsService.save();
//}else{
// for ()
//}
} }

View File

@ -35,6 +35,11 @@ public class ProcessMaterialsBomServiceImpl extends AbstractService<ProcessMater
return processMaterialsBomMapper.findMaterilaListByProcessBomId(processBom); return processMaterialsBomMapper.findMaterilaListByProcessBomId(processBom);
} }
@Override
public List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams) {
return processMaterialsBomMapper.findProcMatBomVoListByProcBom(procMatBomParams);
}
//@Override //@Override
//public List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) { //public List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) {

View File

@ -144,20 +144,20 @@ public class MtAloneProcessController {
params.setCompanyId(currentUser.getCompanyId()); params.setCompanyId(currentUser.getCompanyId());
PageHelper.startPage(params.getPageNum(), params.getPageSize()); PageHelper.startPage(params.getPageNum(), params.getPageSize());
ProcessAndMaterials processAndMaterials = mtAloneProcessService.queryProcessDetail(params); ProcessAndMaterialsBom processAndMaterialsBom = mtAloneProcessService.queryProcessDetail(params);
return ResultGenerator.genSuccessResult(processAndMaterials); return ResultGenerator.genSuccessResult(processAndMaterialsBom);
} }
/** /**
* hy正在用 * hy正在用
* 工序处理完毕时点击提交同时更新工序信息保存物料信息更新物料库存信息 * 工序处理完毕时点击提交同时更新工序信息保存物料信息更新物料库存信息
* @param productAndProcess * @param processAndProcMat
* @param currentUser * @param currentUser
* @return * @return
*/ */
@ApiOperation(value = "工序及物料信息保存", notes = "工序及物料信息保存") @ApiOperation(value = "工序及物料信息保存", notes = "工序及物料信息保存")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "productAndProcess", value = "批次生产加工及工序", paramType = "body", dataType = "ProductAndProcess", required = true) @ApiImplicitParam(name = "processAndProcMat", value = "工序及物料", paramType = "body", dataType = "ProcessAndProcMat", required = true)
}) })
@OperateLog(description = "工序及物料信息保存", type = "更新、保存") @OperateLog(description = "工序及物料信息保存", type = "更新、保存")
@PostMapping("/saveProcAndProcMat") @PostMapping("/saveProcAndProcMat")