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

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

View File

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

View File

@ -1,5 +1,6 @@
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.project.seed.core.service.Service;
@ -15,6 +16,8 @@ public interface MtAloneProcessService extends Service<MtAloneProcess, Integer>
ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params);
void saveProcAndProcMat(ProcessAndProcMat processAndProcMat, CurrentUser currentUser);
//List<MtAloneProcess> findList(MtAloneProcessParams params) ;

View File

@ -1,5 +1,6 @@
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.model.*;
import com.deer.wms.produce.manage.service.MtAloneProcessService;
@ -53,7 +54,6 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
return mtAloneProcessMapper.findProcessVoListByProductProcess(params);
}
/*接着写*/
@Override
public ProcessAndMaterials queryProcessDetail(MtAloneProcessParams params) {
//根据工序id查询工序详细信息
@ -76,6 +76,19 @@ public class MtAloneProcessServiceImpl extends AbstractService<MtAloneProcess, I
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
//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());
ProductProcessBomPo productProcessBomPo = new ProductProcessBomPo();
productProcessBomPo.setProductProcessBom(productProcessBom);
productProcessBomPo.setProcessBomList(processBomList);
if(null != productProcessBom) {
productProcessBomPo.setSpecification(productProcessBom.getSpecification());
productProcessBomPo.setProcessContent(productProcessBom.getProcessContent());
}
return productProcessBomPo;
}
}

View File

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

View File

@ -138,13 +138,35 @@ public class MtAloneProcessController {
@OperateLog(description = "根据工序id查询工序详情及物料信息", type = "查询")
@GetMapping("/query/process/detail")
public Result queryProcessDetail(MtAloneProcessParams params, @ApiIgnore @User CurrentUser currentUser) {
//if(currentUser==null){
// return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
//}
if(currentUser==null){
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
}
params.setCompanyId(1);
params.setCompanyId(currentUser.getCompanyId());
PageHelper.startPage(params.getPageNum(), params.getPageSize());
ProcessAndMaterials processAndMaterials = mtAloneProcessService.queryProcessDetail(params);
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部分数据和工序数据")
@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 = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false)
})
@GetMapping("/and/product/bom/by/prodbom")
public Result ProductAndProcessBomByProdBom(ProcessBomParams params, @ApiIgnore @User CurrentUser currentUser){