From 7f450f70a41e2e7c0ef64e72f7b6a10aa5c576eb Mon Sep 17 00:00:00 2001 From: hy2250089 Date: Mon, 30 Dec 2019 19:32:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E4=BF=9D=E5=AD=98=E6=89=B9?= =?UTF-8?q?=E6=AC=A1=E5=8A=A0=E5=B7=A5=E5=8D=95=E3=80=81=E5=B7=A5=E5=BA=8F?= =?UTF-8?q?=E3=80=81=E7=89=A9=E6=96=99=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/mapper/ProcessMaterialsMapper.xml | 4 +- .../manage/model/ProcessMaterials.java | 6 +- .../manage/service/ProductProcessService.java | 2 + .../impl/ProductProcessServiceImpl.java | 67 +++++++++++++++++++ .../manage/web/ProductProcessController.java | 52 +++++++------- 5 files changed, 103 insertions(+), 28 deletions(-) diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProcessMaterialsMapper.xml b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProcessMaterialsMapper.xml index 8207ac6..df8ddb4 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProcessMaterialsMapper.xml +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/mapper/ProcessMaterialsMapper.xml @@ -9,7 +9,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProcessMaterials.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProcessMaterials.java index 62f4814..a2837d4 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProcessMaterials.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/model/ProcessMaterials.java @@ -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; } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java index 88387c5..e0d339b 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/ProductProcessService.java @@ -21,4 +21,6 @@ public interface ProductProcessService extends Service void saveInitial(ProductProcessHo productProcessHo, CurrentUser currentUser); ProductProcessHo initialProdProcByProdProcBom(ProductProcessBomParams params); + + void addProduceProcess(ProductProcessHo productProcessHo, CurrentUser currentUser); } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java index 3c1cab7..e217d55 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/service/impl/ProductProcessServiceImpl.java @@ -41,6 +41,9 @@ public class ProductProcessServiceImpl extends AbstractService findList(ProductProcessParams params) { return productProcessMapper.findList(params); @@ -197,4 +200,68 @@ public class ProductProcessServiceImpl extends AbstractService processHoList = productProcessHo.getProcessHoList(); + List processList; + List processMaterialsList; + if(null != processHoList) { + processList = new ArrayList(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(); + for (int i=0; i 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); + } + } + } diff --git a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java index 7f5a296..3149600 100644 --- a/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java +++ b/wms-produce-manage/src/main/java/com/deer/wms/produce/manage/web/ProductProcessController.java @@ -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(); + } }