修改生产加工单与工序关联

This commit is contained in:
hy2250089 2019-12-24 20:45:28 +08:00
parent 4047e7396e
commit 994c8ce18d
9 changed files with 106 additions and 46 deletions

View File

@ -0,0 +1,29 @@
package com.deer.wms.produce.manage.model;
/**
* @Author: hy
* @Date: 2019/12/23 20:06
* @Version 1.0
*/
public class ProcessAndProcMat {
private MtAloneProcessVo mtAloneProcessVo;
private ProcessMaterialsVo[] processMaterialsVo;
public MtAloneProcessVo getMtAloneProcessVo() {
return mtAloneProcessVo;
}
public void setMtAloneProcessVo(MtAloneProcessVo mtAloneProcessVo) {
this.mtAloneProcessVo = mtAloneProcessVo;
}
public ProcessMaterialsVo[] getProcessMaterialsVo() {
return processMaterialsVo;
}
public void setProcessMaterialsVo(ProcessMaterialsVo[] processMaterialsVo) {
this.processMaterialsVo = processMaterialsVo;
}
}

View File

@ -12,7 +12,7 @@ import java.util.List;
public class ProductAndProcess { public class ProductAndProcess {
private ProductProcess productProcess;//批次生产加工信息 private ProductProcess productProcess;//批次生产加工信息
private MtAloneProcessVo[] processesVo;//工序扩展信息 private List<MtAloneProcessVo> processVoList;//工序扩展信息
public ProductProcess getProductProcess() { public ProductProcess getProductProcess() {
return productProcess; return productProcess;
@ -22,11 +22,11 @@ public class ProductAndProcess {
this.productProcess = productProcess; this.productProcess = productProcess;
} }
public MtAloneProcessVo[] getProcessesVo() { public List<MtAloneProcessVo> getProcessVoList() {
return processesVo; return processVoList;
} }
public void setProcessesVo(MtAloneProcessVo[] processesVo) { public void setProcessVoList(List<MtAloneProcessVo> processVoList) {
this.processesVo = processesVo; this.processVoList = processVoList;
} }
} }

View File

@ -8,26 +8,17 @@ import java.util.List;
* @Version 1.0 * @Version 1.0
*/ */
public class ProductProcessBomPo { public class ProductProcessBomPo {
private String specification;//加工规格型号 private ProductProcessBom productProcessBom;//产品bom
private String processContent;//加工描述内容
private List<ProcessBom> processBomList;//产品bom下的工序bom private List<ProcessBom> processBomList;//产品bom下的工序bom
public String getSpecification() { public ProductProcessBom getProductProcessBom() {
return specification; return productProcessBom;
} }
public void setSpecification(String specification) { public void setProductProcessBom(ProductProcessBom productProcessBom) {
this.specification = specification; this.productProcessBom = productProcessBom;
}
public String getProcessContent() {
return processContent;
}
public void setProcessContent(String processContent) {
this.processContent = processContent;
} }
public List<ProcessBom> getProcessBomList() { public List<ProcessBom> getProcessBomList() {

View File

@ -1,5 +1,6 @@
package com.deer.wms.produce.manage.service; package com.deer.wms.produce.manage.service;
import com.deer.wms.intercept.common.data.CurrentUser;
import com.deer.wms.produce.manage.model.*; import com.deer.wms.produce.manage.model.*;
import com.deer.wms.project.seed.core.service.Service; import com.deer.wms.project.seed.core.service.Service;
@ -15,6 +16,8 @@ public interface MtAloneProcessService extends Service<MtAloneProcess, Integer>
ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params); ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params);
void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser);
//List<MtAloneProcess> findList(MtAloneProcessParams params) ; //List<MtAloneProcess> findList(MtAloneProcessParams params) ;

View File

@ -1,5 +1,6 @@
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.produce.manage.dao.MtAloneProcessMapper; import com.deer.wms.produce.manage.dao.MtAloneProcessMapper;
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;
@ -53,7 +54,6 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
return mtAloneProcessMapper.findProcessVoListByProductProcess(params); return mtAloneProcessMapper.findProcessVoListByProductProcess(params);
} }
/*接着写*/
@Override @Override
public ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params) { public ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params) {
//根据工序id查询工序详细信息 //根据工序id查询工序详细信息
@ -76,6 +76,19 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
return processAndMaterials; return processAndMaterials;
} }
@Override
public void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser) {
//前端对工序赋值更新工序
MtAloneProcessVo mtAloneProcessVo = processAndProcMat.getMtAloneProcessVo();
MtAloneProcess mtAloneProcess = new MtAloneProcess();
BeanUtils.copyProperties(mtAloneProcessVo, mtAloneProcess);
mtAloneProcessMapper.updateByPrimaryKey(mtAloneProcess);
//前端对物料用量赋值保存物料
}
//@Override //@Override
//public List<MtAloneProcess> findList(MtAloneProcessParams params) { //public List<MtAloneProcess> findList(MtAloneProcessParams params) {

View File

@ -73,11 +73,9 @@ public class ProcessBomServiceImpl extends AbstractService<ProcessBom, Integer>
ProductProcessBom productProcessBom = productProcessBomService.findById(params.getProductProcessId()); ProductProcessBom productProcessBom = productProcessBomService.findById(params.getProductProcessId());
ProductProcessBomPo productProcessBomPo = new ProductProcessBomPo(); ProductProcessBomPo productProcessBomPo = new ProductProcessBomPo();
productProcessBomPo.setProductProcessBom(productProcessBom);
productProcessBomPo.setProcessBomList(processBomList); productProcessBomPo.setProcessBomList(processBomList);
if(null != productProcessBom) {
productProcessBomPo.setSpecification(productProcessBom.getSpecification());
productProcessBomPo.setProcessContent(productProcessBom.getProcessContent());
}
return productProcessBomPo; return productProcessBomPo;
} }
} }

View File

@ -28,6 +28,9 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
@Autowired @Autowired
private ProductProcessMapper productProcessMapper; private ProductProcessMapper productProcessMapper;
@Autowired
private ProductProcessService productProcessService;
@Autowired @Autowired
private ProcessBomService processBomService; private ProcessBomService processBomService;
@ -58,7 +61,7 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
@Override @Override
public void saveProdAndProc(ProductAndProcess productAndProcess, CurrentUser currentUser) { public void saveProdAndProc(ProductAndProcess productAndProcess, CurrentUser currentUser) {
//首先保存批次产品加工信息 //保存批次产品加工信息
ProductProcess productProcess = productAndProcess.getProductProcess(); ProductProcess productProcess = productAndProcess.getProductProcess();
Date date = new Date(); Date date = new Date();
productProcess.setOperatorId(currentUser.getUserId()); productProcess.setOperatorId(currentUser.getUserId());
@ -72,33 +75,36 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
productProcess.setCompanyId(currentUser.getCompanyId()); productProcess.setCompanyId(currentUser.getCompanyId());
productProcessMapper.insert(productProcess); productProcessMapper.insert(productProcess);
//其次保存由前端获取的工序信息 //保存由前端获取的工序信息
MtAloneProcessVo[] processesVo = productAndProcess.getProcessesVo(); List<MtAloneProcessVo> processVoList = productAndProcess.getProcessVoList();
if(null != processesVo) { if(null != processVoList) {
MtAloneProcess[] processes = new MtAloneProcess[processesVo.length]; List<MtAloneProcess> processList = new ArrayList<MtAloneProcess>(processVoList.size());
for (int i = 0; i < processesVo.length; i++) { for (MtAloneProcess processVo : processVoList) {
processes[i] = new MtAloneProcess(); MtAloneProcess process = new MtAloneProcess();
BeanUtils.copyProperties(processesVo[i], processes[i]); BeanUtils.copyProperties(processVo, process);
processService.save(processes[i]); process.setProductProcessId(productProcess.getId());
processList.add(process);
} }
processService.save(processList);
} }
} }
@Override @Override
public ProductAndProcess queryProductProcessDetail(ProductProcessParams params) { public ProductAndProcess queryProductProcessDetail(ProductProcessParams params) {
//根据批次加工id查询批次产品加工单信息 //根据批次产加工id查询批次产品加工单信息
ProductProcess productProcess = productProcessMapper.selectByPrimaryKey(params.getProductProcessId()); ProductProcess productProcess = productProcessMapper.selectByPrimaryKey(params.getProductProcessId());
//根据批次产品加工id查询工序信息 //根据批次产品加工id查询工序信息
List<MtAloneProcessVo> processVoList = processService.findProcessVoListByProductProcess(params); List<MtAloneProcessVo> tempProcessVoList = processService.findProcessVoListByProductProcess(params);
ProductAndProcess productAndProcess = new ProductAndProcess(); ProductAndProcess productAndProcess = new ProductAndProcess();
productAndProcess.setProductProcess(productProcess); productAndProcess.setProductProcess(productProcess);
if(null != processVoList) { List<MtAloneProcessVo> processVoList;
MtAloneProcessVo[] processesVo = new MtAloneProcessVo[processVoList.size()]; if(null != tempProcessVoList) {
for (int i = 0; i < processesVo.length; i++) { processVoList = new ArrayList<MtAloneProcessVo>(tempProcessVoList.size());
processesVo[i] = processVoList.get(i); for (MtAloneProcessVo processVo : tempProcessVoList) {
processVoList.add(processVo);
} }
productAndProcess.setProcessesVo(processesVo); productAndProcess.setProcessVoList(processVoList);
} }
return productAndProcess; return productAndProcess;

View File

@ -138,13 +138,35 @@ public class MtAloneProcessController {
@OperateLog(description = "根据工序id查询工序详情及物料信息", type = "查询") @OperateLog(description = "根据工序id查询工序详情及物料信息", type = "查询")
@GetMapping("/query/process/detail") @GetMapping("/query/process/detail")
public Result queryProcessDetail(MtAloneProcessParams params, @ApiIgnore @User CurrentUser currentUser) { public Result queryProcessDetail(MtAloneProcessParams params, @ApiIgnore @User CurrentUser currentUser) {
//if(currentUser==null){ if(currentUser==null){
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null ); return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
//} }
params.setCompanyId(1); params.setCompanyId(currentUser.getCompanyId());
PageHelper.startPage(params.getPageNum(), params.getPageSize()); PageHelper.startPage(params.getPageNum(), params.getPageSize());
ProcessAndMaterials processAndMaterials = mtAloneProcessService.queryProcessDetail(params); ProcessAndMaterials processAndMaterials = mtAloneProcessService.queryProcessDetail(params);
return ResultGenerator.genSuccessResult(processAndMaterials); return ResultGenerator.genSuccessResult(processAndMaterials);
} }
/**
* hy正在用
* 工序处理完毕时点击提交同时更新工序信息保存物料信息更新物料库存信息
* @param productAndProcess
* @param currentUser
* @return
*/
@ApiOperation(value = "工序及物料信息保存", notes = "工序及物料信息保存")
@ApiImplicitParams({
@ApiImplicitParam(name = "productAndProcess", value = "批次生产加工及工序", paramType = "body", dataType = "ProductAndProcess", required = true)
})
@OperateLog(description = "工序及物料信息保存", type = "更新、保存")
@PostMapping("/saveProcAndProcMat")
public Result saveProcAndProcMat(@RequestBody ProcessAndProcMat processAndProcMat, @ApiIgnore @User CurrentUser currentUser) {
//if(currentUser==null){
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
//}
mtAloneProcessService.saveProcAndProcMat(processAndProcMat, currentUser);
return ResultGenerator.genSuccessResult();
}
} }

View File

@ -161,10 +161,8 @@ public class ProcessBomController {
*/ */
@ApiOperation(value = "根据产品bom的id获取产品bom部分数据和工序数据", notes = "根据产品bom的id获取产品bom部分数据和工序数据") @ApiOperation(value = "根据产品bom的id获取产品bom部分数据和工序数据", notes = "根据产品bom的id获取产品bom部分数据和工序数据")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "access-token", value = "token", paramType = "header", dataType = "String", required = true),
@ApiImplicitParam(name = "productProcessId", value = "产品bom的id", paramType = "query", dataType = "int", required = true), @ApiImplicitParam(name = "productProcessId", value = "产品bom的id", paramType = "query", dataType = "int", required = true),
@ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false) @ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false)
}) })
@GetMapping("/and/product/bom/by/prodbom") @GetMapping("/and/product/bom/by/prodbom")
public Result ProductAndProcessBomByProdBom(ProcessBomParams params, @ApiIgnore @User CurrentUser currentUser){ public Result ProductAndProcessBomByProdBom(ProcessBomParams params, @ApiIgnore @User CurrentUser currentUser){