查询工序详情、保存工序及物料修改
This commit is contained in:
parent
994c8ce18d
commit
ab07aed1af
@ -17,4 +17,5 @@ public interface ProcessMaterialsBomMapper extends Mapper<ProcessMaterialsBom> {
|
||||
|
||||
void insertOrUpdate(List<ProcessMaterialsBom> processMaterialsBomList);
|
||||
|
||||
List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams);
|
||||
}
|
@ -95,7 +95,7 @@
|
||||
<if test="companyId != null">
|
||||
AND process.company_id = #{companyId}
|
||||
</if>
|
||||
</where>
|
||||
</where> ORDER BY process.process_step
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -60,6 +60,20 @@
|
||||
|
||||
</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 materials.code, materials.materials_name,
|
||||
unit.unit_name, matbom.specification, procbom.process_name,
|
||||
@ -82,6 +96,7 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findListByProcessBomId" parameterType="com.deer.wms.produce.manage.model.ProcessMaterialsBomParams" resultMap="BaseResultMap">
|
||||
SELECT matbom.*
|
||||
FROM mt_alone_process_materials_bom matbom
|
||||
|
@ -115,7 +115,7 @@
|
||||
<if test="companyId != null">
|
||||
AND prodproc.company_id = #{companyId}
|
||||
</if>
|
||||
</where>
|
||||
</where> ORDER BY prodproc.create_time DESC, prodproc.update_time DESC
|
||||
</select>
|
||||
|
||||
<!--没用
|
||||
|
@ -10,6 +10,8 @@ public class MtAloneProcessParams extends QueryParams {
|
||||
|
||||
private Integer productBomId;
|
||||
|
||||
private Integer processBomId;
|
||||
|
||||
public Integer getProcessId() {
|
||||
return processId;
|
||||
}
|
||||
@ -25,4 +27,12 @@ public class MtAloneProcessParams extends QueryParams {
|
||||
public void setProductBomId(Integer productBomId) {
|
||||
this.productBomId = productBomId;
|
||||
}
|
||||
|
||||
public Integer getProcessBomId() {
|
||||
return processBomId;
|
||||
}
|
||||
|
||||
public void setProcessBomId(Integer processBomId) {
|
||||
this.processBomId = processBomId;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -23,8 +23,6 @@ public class ProcessMaterialsBomVo extends ProcessMaterialsBom {
|
||||
|
||||
private Float remain;//剩余数量
|
||||
|
||||
|
||||
|
||||
public String getProcessName() {
|
||||
return processName;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ public interface MtAloneProcessService extends Service<MtAloneProcess, Integer>
|
||||
|
||||
List<MtAloneProcessVo> findProcessVoListByProductProcess(ProductProcessParams params);
|
||||
|
||||
ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params);
|
||||
ProcessAndMaterialsBom queryProcessDetail(MtAloneProcessParams params);
|
||||
|
||||
void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser);
|
||||
|
||||
|
@ -16,6 +16,8 @@ public interface ProcessMaterialsBomService extends Service<ProcessMaterialsBom,
|
||||
|
||||
List<MaterialInfoVo> findMaterilaListByProcessBomId(ProcessBom processBom);
|
||||
|
||||
List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams);
|
||||
|
||||
|
||||
//List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) ;
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
package com.deer.wms.produce.manage.service.impl;
|
||||
|
||||
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.ProcessMaterialsMapper;
|
||||
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.ProcessMaterialsBomService;
|
||||
import com.deer.wms.produce.manage.service.ProcessMaterialsService;
|
||||
import com.deer.wms.project.seed.core.service.AbstractService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -13,6 +16,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -31,6 +35,9 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
@Autowired
|
||||
private ProcessMaterialsService processMaterialsService;
|
||||
|
||||
@Autowired
|
||||
private ProcessMaterialsBomService processMaterialsBomService;
|
||||
|
||||
@Override
|
||||
public List<MtAloneProcess> findProcessListByProductBom(ProcessBomParams params) {
|
||||
//通过产品bom获取工序bom
|
||||
@ -55,25 +62,21 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params) {
|
||||
public ProcessAndMaterialsBom queryProcessDetail(MtAloneProcessParams params) {
|
||||
//根据工序id查询工序详细信息
|
||||
MtAloneProcessVo processVo = (MtAloneProcessVo) mtAloneProcessMapper.selectProcessVoByProcessId(params);
|
||||
|
||||
//根据工序id查询物料信息
|
||||
List<ProcessMaterialsVo> processMaterialsVoList = processMaterialsService.findProcMatVoListByProcess(params);
|
||||
//根据工序bom的id查询物料bom信息
|
||||
ProcessMaterialsBomParams procMatBomParams = new ProcessMaterialsBomParams();
|
||||
procMatBomParams.setProcessBomId(processVo.getProcessBomId());
|
||||
procMatBomParams.setCompanyId(params.getCompanyId());
|
||||
List<ProcessMaterialsBomVo> procMatBomVoList = processMaterialsBomService.findProcMatBomVoListByProcBom(procMatBomParams);
|
||||
|
||||
ProcessAndMaterials processAndMaterials = new ProcessAndMaterials();
|
||||
processAndMaterials.setProcessVo(processVo);
|
||||
if(null != processMaterialsVoList) {
|
||||
ProcessMaterialsVo[] processMaterialsVo = new ProcessMaterialsVo[processMaterialsVoList.size()];
|
||||
for (int i = 0; i < processMaterialsVo.length; i++) {
|
||||
processMaterialsVo[i] = processMaterialsVoList.get(i);
|
||||
}
|
||||
processAndMaterials.setProcessMaterialsVo(processMaterialsVo);
|
||||
}
|
||||
ProcessAndMaterialsBom processAndMaterialsBom = new ProcessAndMaterialsBom();
|
||||
processAndMaterialsBom.setProcessVo(processVo);
|
||||
processAndMaterialsBom.setProcMatBomVoList(procMatBomVoList);
|
||||
|
||||
|
||||
return processAndMaterials;
|
||||
return processAndMaterialsBom;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -84,7 +87,37 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
|
||||
BeanUtils.copyProperties(mtAloneProcessVo, 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 ()
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,11 @@ public class ProcessMaterialsBomServiceImpl extends AbstractService<ProcessMater
|
||||
return processMaterialsBomMapper.findMaterilaListByProcessBomId(processBom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessMaterialsBomVo> findProcMatBomVoListByProcBom(ProcessMaterialsBomParams procMatBomParams) {
|
||||
return processMaterialsBomMapper.findProcMatBomVoListByProcBom(procMatBomParams);
|
||||
}
|
||||
|
||||
|
||||
//@Override
|
||||
//public List<ProcessMaterialsBom> findList(ProcessMaterialsBomParams params) {
|
||||
|
@ -144,20 +144,20 @@ public class MtAloneProcessController {
|
||||
|
||||
params.setCompanyId(currentUser.getCompanyId());
|
||||
PageHelper.startPage(params.getPageNum(), params.getPageSize());
|
||||
ProcessAndMaterials processAndMaterials = mtAloneProcessService.queryProcessDetail(params);
|
||||
return ResultGenerator.genSuccessResult(processAndMaterials);
|
||||
ProcessAndMaterialsBom processAndMaterialsBom = mtAloneProcessService.queryProcessDetail(params);
|
||||
return ResultGenerator.genSuccessResult(processAndMaterialsBom);
|
||||
}
|
||||
|
||||
/**
|
||||
* hy正在用
|
||||
* 工序处理完毕时,点击提交同时更新工序信息、保存物料信息、更新物料库存信息
|
||||
* @param productAndProcess
|
||||
* @param processAndProcMat
|
||||
* @param currentUser
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "工序及物料信息保存", notes = "工序及物料信息保存")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "productAndProcess", value = "批次生产加工及工序", paramType = "body", dataType = "ProductAndProcess", required = true)
|
||||
@ApiImplicitParam(name = "processAndProcMat", value = "工序及物料", paramType = "body", dataType = "ProcessAndProcMat", required = true)
|
||||
})
|
||||
@OperateLog(description = "工序及物料信息保存", type = "更新、保存")
|
||||
@PostMapping("/saveProcAndProcMat")
|
||||
|
Loading…
Reference in New Issue
Block a user