初步保存批次加工单、工序、物料信息接口修改
This commit is contained in:
parent
9496e2391d
commit
7f450f70a4
@ -9,7 +9,7 @@
|
||||
<result column="operator_id" jdbcType="INTEGER" property="operatorId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="version" jdbcType="VARCHAR" property="version" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="process_id" jdbcType="INTEGER" property="processId" />
|
||||
<result column="materials_bom_id" jdbcType="INTEGER" property="materialsBomId" />
|
||||
@ -28,7 +28,7 @@
|
||||
<result column="operator_id" jdbcType="INTEGER" property="operatorId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="version" jdbcType="INTEGER" property="version" />
|
||||
<result column="version" jdbcType="VARCHAR" property="version" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="process_id" jdbcType="INTEGER" property="processId" />
|
||||
<result column="materials_bom_id" jdbcType="INTEGER" property="materialsBomId" />
|
||||
|
@ -30,7 +30,7 @@ public class ProcessMaterials {
|
||||
/**
|
||||
* 版本号 默认为 1.1
|
||||
*/
|
||||
private Integer version;
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* 状态 0使用,1禁用
|
||||
@ -158,7 +158,7 @@ public class ProcessMaterials {
|
||||
*
|
||||
* @return version - 版本号 默认为 1.1
|
||||
*/
|
||||
public Integer getVersion() {
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ public class ProcessMaterials {
|
||||
*
|
||||
* @param version 版本号 默认为 1.1
|
||||
*/
|
||||
public void setVersion(Integer version) {
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
@ -21,4 +21,6 @@ public interface ProductProcessService extends Service<ProductProcess, Integer>
|
||||
void saveInitial(ProductProcessHo productProcessHo, CurrentUser currentUser);
|
||||
|
||||
ProductProcessHo initialProdProcByProdProcBom(ProductProcessBomParams params);
|
||||
|
||||
void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser);
|
||||
}
|
||||
|
@ -41,6 +41,9 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
@Autowired
|
||||
private ProcessMaterialsBomService processMaterialsBomService;
|
||||
|
||||
@Autowired
|
||||
private ProcessMaterialsService processMaterialsService;
|
||||
|
||||
@Override
|
||||
public List<ProductProcessVo> findList(ProductProcessParams params) {
|
||||
return productProcessMapper.findList(params);
|
||||
@ -197,4 +200,68 @@ public class ProductProcessServiceImpl extends AbstractService<ProductProcess, I
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser) {
|
||||
//保存批次产品加工信息
|
||||
Date date = new Date();
|
||||
ProductProcess productProcess = new ProductProcess();
|
||||
BeanUtils.copyProperties(productProcessHo, productProcess);
|
||||
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<ProcessHo> processHoList = productProcessHo.getProcessHoList();
|
||||
List<MtAloneProcess> processList;
|
||||
List<ProcessMaterials> processMaterialsList;
|
||||
if(null != processHoList) {
|
||||
processList = new ArrayList<MtAloneProcess>(processHoList.size());
|
||||
for (ProcessHo processHo : processHoList) {
|
||||
MtAloneProcess process = new MtAloneProcess();
|
||||
BeanUtils.copyProperties(processHo, process);
|
||||
process.setOperatorId(currentUser.getUserId());
|
||||
process.setCreateTime(date);
|
||||
process.setUpdateTime(date);
|
||||
process.setVersion("1.1");
|
||||
process.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
process.setProductProcessId(productProcess.getId());
|
||||
process.setCode(ProduceManagePublicMethod.creatUniqueCode("GX"));
|
||||
process.setCompanyId(currentUser.getCompanyId());
|
||||
processList.add(process);
|
||||
|
||||
}
|
||||
processService.save(processList);
|
||||
|
||||
processMaterialsList = new ArrayList<ProcessMaterials>();
|
||||
for (int i=0; i<processList.size(); i++) {
|
||||
MtAloneProcess process = processList.get(i);
|
||||
ProcessHo processHo = processHoList.get(i);
|
||||
List<ProcessMaterialsVo> processMaterialsVoList = processHo.getProcessMaterialsVoList();
|
||||
if(null != processMaterialsVoList) {
|
||||
for (ProcessMaterialsVo processMaterialsVo : processMaterialsVoList) {
|
||||
ProcessMaterials processMaterials = new ProcessMaterials();
|
||||
BeanUtils.copyProperties(processMaterialsVo, processMaterials);
|
||||
processMaterials.setOperatorId(currentUser.getUserId());
|
||||
processMaterials.setCreateTime(date);
|
||||
processMaterials.setUpdateTime(date);
|
||||
processMaterials.setVersion("1.1");
|
||||
processMaterials.setStatus(ProduceManageConstant.STATUS_AVAILABLE);
|
||||
processMaterials.setProcessId(process.getId());
|
||||
processMaterials.setCode(ProduceManagePublicMethod.creatUniqueCode("SCWL"));
|
||||
processMaterials.setCompanyId(currentUser.getCompanyId());
|
||||
processMaterialsList.add(processMaterials);
|
||||
}
|
||||
}
|
||||
}
|
||||
processMaterialsService.save(processMaterialsList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ public class ProductProcessController {
|
||||
private ProcessBomService processBomService;
|
||||
|
||||
/**
|
||||
* hy
|
||||
* hy暂时没用
|
||||
* 生成某种产品某一批次的生产加工单
|
||||
* 需要调用对应产品bom
|
||||
* @param productProcess
|
||||
@ -160,17 +160,24 @@ public class ProductProcessController {
|
||||
* hy正在用
|
||||
* 新建批次产品加工时,选择产品bom后,
|
||||
* 生成加工单、工序、物料信息并对其初步赋值,用于表格展示
|
||||
* @param
|
||||
* @param params
|
||||
* @param currentUser
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "初始化批次生产加工单信息", notes = "初始化批次生产加工单信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "productBomId", value = "产品bom的id", paramType = "query", dataType = "int", required = true),
|
||||
@ApiImplicitParam(name = "companyId", value = "公司id", paramType = "query", dataType = "int", required = false)
|
||||
|
||||
})
|
||||
@OperateLog(description = "初始化批次生产加工单信息", type = "查询")
|
||||
@GetMapping("/initialProdProcByProdProcBom")
|
||||
public Result initialProdProcByProdProcBom(ProductProcessBomParams 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());
|
||||
ProductProcessHo productProcessHo = productProcessService.initialProdProcByProdProcBom(params);
|
||||
return ResultGenerator.genSuccessResult(productProcessHo);
|
||||
}
|
||||
@ -178,26 +185,25 @@ public class ProductProcessController {
|
||||
|
||||
/**
|
||||
* hy正在用
|
||||
* 首次新建批次产品加工时,点击提交初步根据bom对加工单、工序、物料信息赋值,并保存
|
||||
* @param
|
||||
* 新建批次产品加工时,点击提交按钮在库表中同时保存初步的加工单、工序、物料信息
|
||||
* @param productProcessHo
|
||||
* @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);
|
||||
//}
|
||||
@ApiOperation(value = "新增批次生产加工单", notes = "新增批次生产加工单")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "productProcessHo", value = "批次生产加工信息", paramType = "body", dataType = "ProductProcessHo", required = true)
|
||||
})
|
||||
@OperateLog(description = "新增批次生产加工单", type = "保存")
|
||||
@PostMapping("/addProductProcess")
|
||||
public Result addProductProcess(@RequestBody ProductProcessHo productProcessHo, @ApiIgnore @User CurrentUser currentUser) {
|
||||
if(currentUser==null){
|
||||
return ResultGenerator.genFailResult(CommonCode.SERVICE_ERROR,"未登录错误",null );
|
||||
}
|
||||
|
||||
productProcessService.addProduceProcess(productProcessHo, currentUser);
|
||||
return ResultGenerator.genSuccessResult();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user