From 3cfb4291ab49a3a1db2781113418f0aba2a3931f Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Wed, 13 Mar 2024 11:34:13 +0800 Subject: [PATCH 1/6] =?UTF-8?q?wms=E6=88=90=E5=93=81=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B911?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WmsToWCSmissionController.java | 20 +++++++++++++++++ .../op/wms/domain/WmsProductPutTrayCode.java | 10 +++++++++ .../impl/WmsProductPutServiceImpl.java | 22 +++++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java index b571ce8d2..11c5b7bcb 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/WmsToWCSmissionController.java @@ -235,6 +235,26 @@ public class WmsToWCSmissionController { public AjaxResult WmsProductPutByWorkOrderConfirm(@RequestBody WmsProductPut wmsProductPut) { return AjaxResult.success(wmsProductPutService.WmsProductPutByWorkOrderConfirm(wmsProductPut)); } + + + /** + * 成品 + * 托盘关联箱码 + */ + @PostMapping("/addSnCorrelationBarcode") + public AjaxResult addSnCorrelationBarcode(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) { + return AjaxResult.success(wmsProductPutService.addSnCorrelationBarcode(wmsProductPutTrayCode)); + } + + + /** + * 查询托盘和箱码的关系信息 + * + */ + @PostMapping("/selectSnCorrelationBarcode") + public AjaxResult selectSnCorrelationBarcode(@RequestBody WmsProductPutTrayCode wmsProductPutTrayCode) { + return AjaxResult.success(wmsProductPutService.selectSnCorrelationBarcode(wmsProductPutTrayCode)); + } /** * 手持白胚入库查询 */ diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPutTrayCode.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPutTrayCode.java index 173f9bd88..546f78ba0 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPutTrayCode.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/WmsProductPutTrayCode.java @@ -43,6 +43,16 @@ public class WmsProductPutTrayCode extends BaseEntity { */ @Excel(name = "关联状态") private String relatStatus; + @Excel(name = "工厂") + private String siteCode; + + public String getSiteCode() { + return siteCode; + } + + public void setSiteCode(String siteCode) { + this.siteCode = siteCode; + } /** * 预留字段1 diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index e80f277b0..ebf52618f 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -56,6 +56,9 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { private WmsOdsEmStorageNewsSnMapper wmsOdsEmStorageNewsSnMapper; @Autowired private WmsOdsEmStorageNewsMapper wmsOdsEmStorageNewsMapper; + + @Autowired + private WmsProductPutTrayCodeMapper wmsProductPutTrayCodeMapper; /** * 查询成品生产入库 * @@ -639,4 +642,23 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { return result; } + @Override + public List selectSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode) { + DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode()); + wmsProductPutTrayCode.setRelatStatus("1"); + List wmsProductPutTrayCodeList= wmsProductPutTrayCodeMapper.selectWmsProductPutTrayCodeList(wmsProductPutTrayCode); + return wmsProductPutTrayCodeList; + } + + @Override + public String addSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode) { + String result="关联成功"; + DynamicDataSourceContextHolder.push("ds_" + wmsProductPutTrayCode.getSiteCode()); + wmsProductPutTrayCode.setRelatStatus("1"); + wmsProductPutTrayCode.setStorageId(IdUtils.fastSimpleUUID()); + wmsProductPutTrayCode.setNumber(1); + wmsProductPutTrayCodeMapper.insertWmsProductPutTrayCode(wmsProductPutTrayCode); + return result; + } + } From b7852ebc0016c6c62da9d63922a1cc367bcd4174 Mon Sep 17 00:00:00 2001 From: mengjiao <3338049200@qq,com> Date: Wed, 13 Mar 2024 11:38:54 +0800 Subject: [PATCH 2/6] =?UTF-8?q?wms=E6=88=90=E5=93=81=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B912?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/op/wms/service/IWmsProductPutService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java index 9b775cb1c..35b25a279 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IWmsProductPutService.java @@ -7,6 +7,7 @@ import com.op.system.api.domain.wms.wmsReportWork; import com.op.wms.domain.ProOrderWorkorder; import com.op.wms.domain.WmsOdsWhiteEmbryoIn; import com.op.wms.domain.WmsProductPut; +import com.op.wms.domain.WmsProductPutTrayCode; /** * 成品生产入库Service接口 @@ -82,4 +83,8 @@ public interface IWmsProductPutService { ProOrderWorkorder selectWmsOdsWhiteEmbryoInhAnd(WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIns); String addtWmsOdsWhiteEmbryoInhAnd(WmsOdsWhiteEmbryoIn wmsOdsWhiteEmbryoIn); + + List selectSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode); + + String addSnCorrelationBarcode(WmsProductPutTrayCode wmsProductPutTrayCode); } From e38f9fe567254fe1ad68b8404141669dc34ef609 Mon Sep 17 00:00:00 2001 From: shaoyong Date: Wed, 13 Mar 2024 14:48:05 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E8=B4=A8=E9=87=8F=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quality/controller/QcGoalController.java | 200 +++---- .../QcGoalDistributeController.java | 187 ++++--- .../mapper/QcGoalDistributeMapper.java | 3 + .../service/IQcGoalDistributeService.java | 67 +++ .../op/quality/service/IQcGoalService.java | 85 +++ .../impl/QcGoalDistributeServiceImpl.java | 327 ++++++------ .../service/impl/QcGoalServiceImpl.java | 490 +++++++++--------- .../quality/QcCheckTaskProduceMapper.xml | 3 +- .../mapper/quality/QcGoalDistributeMapper.xml | 32 ++ 9 files changed, 811 insertions(+), 583 deletions(-) create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalDistributeService.java create mode 100644 op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalService.java diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalController.java index c75368aa3..b6e43d1e7 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalController.java @@ -9,7 +9,7 @@ import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; import com.op.quality.domain.QcGoal; -//import com.op.quality.service.IQcGoalService; +import com.op.quality.service.IQcGoalService; import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.utils.poi.ExcelUtil; @@ -24,103 +24,103 @@ import com.op.common.core.web.page.TableDataInfo; @RestController @RequestMapping("/qcGoal") public class QcGoalController extends BaseController { -// @Autowired -// private IQcGoalService qcGoalService; -// -// /** -// * 查询质量目标列表 -// */ -// @RequiresPermissions("quality:qcGoal:list") -// @GetMapping("/list") -// public TableDataInfo list(QcGoal qcGoal) { -// startPage(); -// List list = qcGoalService.selectQcGoalList(qcGoal); -// return getDataTable(list); -// } -// -// /** -// * 查询二级质量目标 -// */ -// @GetMapping("/getChildrenList/{parentId}") -// public List getChildrenList(@PathVariable("parentId") String parentId) { -// QcGoal goal = new QcGoal(); -// goal.setParentGoal(parentId); -// List list = qcGoalService.selectChildrenByParent(goal); -// return list; -// } -// -// /** -// * 导出质量目标列表 -// */ -// @RequiresPermissions("quality:qcGoal:export") -// @Log(title = "质量目标", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, QcGoal qcGoal) { -// List list = qcGoalService.selectQcGoalList(qcGoal); -// ExcelUtil util = new ExcelUtil(QcGoal. class); -// util.exportExcel(response, list, "质量目标数据"); -// } -// -// /** -// * 获取质量目标详细信息 -// */ -// @RequiresPermissions("quality:qcGoal:query") -// @GetMapping(value = "/{id}") -// public AjaxResult getInfo(@PathVariable("id") String id) { -// return success(qcGoalService.selectQcGoalById(id)); -// } -// -// /** -// * 获取质量目标下拉树列表 -// */ -// @GetMapping("/treeSelect") -// public AjaxResult treeSelect(QcGoal qcGoal) { -// List qcGoals = qcGoalService.selectQcGoalList(qcGoal); -// return success(qcGoalService.buildQcGoalTreeSelect(qcGoals)); -// } -// -// /** -// * 新增质量目标 -// */ -// @RequiresPermissions("quality:qcGoal:add") -// @Log(title = "质量目标", businessType = BusinessType.INSERT) -// @PostMapping -// public AjaxResult add(@RequestBody QcGoal qcGoal) { -// return toAjax(qcGoalService.insertQcGoal(qcGoal)); -// } -// -// /** -// * 拆解质量目标 -// */ -// @GetMapping("/generate/{id}") -// public TableDataInfo generate(@PathVariable("id") String id) { -// List qcGoalList = qcGoalService.generate(id); -// return getDataTable(qcGoalList); -// } -// -// -// /** -// * 修改质量目标 -// */ -// @RequiresPermissions("quality:qcGoal:edit") -// @Log(title = "质量目标", businessType = BusinessType.UPDATE) -// @PutMapping -// public AjaxResult edit(@RequestBody QcGoal qcGoal) { -// return toAjax(qcGoalService.updateQcGoal(qcGoal)); -// } -// -// /** -// * 删除质量目标 -// */ -// @RequiresPermissions("quality:qcGoal:remove") -// @Log(title = "质量目标", businessType = BusinessType.DELETE) -// @DeleteMapping("/{ids}") -// public AjaxResult remove(@PathVariable String[] ids) { -// int rows = qcGoalService.deleteQcGoalByIds(ids); -// if (rows > 0 ) { -// return success("操作成功"); -// }else { -// return error("操作失败,请检查要删除的项目是否含有子项目"); -// } -// } + @Autowired + private IQcGoalService qcGoalService; + + /** + * 查询质量目标列表 + */ + @RequiresPermissions("quality:qcGoal:list") + @GetMapping("/list") + public TableDataInfo list(QcGoal qcGoal) { + startPage(); + List list = qcGoalService.selectQcGoalList(qcGoal); + return getDataTable(list); + } + + /** + * 查询二级质量目标 + */ + @GetMapping("/getChildrenList/{parentId}") + public List getChildrenList(@PathVariable("parentId") String parentId) { + QcGoal goal = new QcGoal(); + goal.setParentGoal(parentId); + List list = qcGoalService.selectChildrenByParent(goal); + return list; + } + + /** + * 导出质量目标列表 + */ + @RequiresPermissions("quality:qcGoal:export") + @Log(title = "质量目标", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcGoal qcGoal) { + List list = qcGoalService.selectQcGoalList(qcGoal); + ExcelUtil util = new ExcelUtil(QcGoal. class); + util.exportExcel(response, list, "质量目标数据"); + } + + /** + * 获取质量目标详细信息 + */ + @RequiresPermissions("quality:qcGoal:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + return success(qcGoalService.selectQcGoalById(id)); + } + + /** + * 获取质量目标下拉树列表 + */ + @GetMapping("/treeSelect") + public AjaxResult treeSelect(QcGoal qcGoal) { + List qcGoals = qcGoalService.selectQcGoalList(qcGoal); + return success(qcGoalService.buildQcGoalTreeSelect(qcGoals)); + } + + /** + * 新增质量目标 + */ + @RequiresPermissions("quality:qcGoal:add") + @Log(title = "质量目标", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcGoal qcGoal) { + return toAjax(qcGoalService.insertQcGoal(qcGoal)); + } + + /** + * 拆解质量目标 + */ + @GetMapping("/generate/{id}") + public TableDataInfo generate(@PathVariable("id") String id) { + List qcGoalList = qcGoalService.generate(id); + return getDataTable(qcGoalList); + } + + + /** + * 修改质量目标 + */ + @RequiresPermissions("quality:qcGoal:edit") + @Log(title = "质量目标", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcGoal qcGoal) { + return toAjax(qcGoalService.updateQcGoal(qcGoal)); + } + + /** + * 删除质量目标 + */ + @RequiresPermissions("quality:qcGoal:remove") + @Log(title = "质量目标", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + int rows = qcGoalService.deleteQcGoalByIds(ids); + if (rows > 0 ) { + return success("操作成功"); + }else { + return error("操作失败,请检查要删除的项目是否含有子项目"); + } + } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalDistributeController.java b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalDistributeController.java index 46e2280f8..d65618a03 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalDistributeController.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/controller/QcGoalDistributeController.java @@ -3,7 +3,6 @@ package com.op.quality.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; -import com.op.quality.domain.QcGoal; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -17,7 +16,7 @@ import com.op.common.log.annotation.Log; import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; import com.op.quality.domain.QcGoalDistribute; -//import com.op.quality.service.IQcGoalDistributeService; +import com.op.quality.service.IQcGoalDistributeService; import com.op.common.core.web.controller.BaseController; import com.op.common.core.web.domain.AjaxResult; import com.op.common.core.utils.poi.ExcelUtil; @@ -32,87 +31,107 @@ import com.op.common.core.web.page.TableDataInfo; @RestController @RequestMapping("/qcGoalDistribute") public class QcGoalDistributeController extends BaseController { -// @Autowired -// private IQcGoalDistributeService qcGoalDistributeService; -// -///** -// * 查询质量目标分配列表 -// */ -//@RequiresPermissions("quality:qcGoalDistribute:list") -//@GetMapping("/list") -// public TableDataInfo list(QcGoalDistribute qcGoalDistribute) { -// startPage(); -// List list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute); -// return getDataTable(list); -// } -// -// /** -// * 导出质量目标分配列表 -// */ -// @RequiresPermissions("quality:qcGoalDistribute:export") -// @Log(title = "质量目标分配", businessType = BusinessType.EXPORT) -// @PostMapping("/export") -// public void export(HttpServletResponse response, QcGoalDistribute qcGoalDistribute) { -// List list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute); -// ExcelUtil util = new ExcelUtil(QcGoalDistribute. class); -// util.exportExcel(response, list, "质量目标分配数据"); -// } -// -// /** -// * 获取质量目标分配详细信息 -// */ -// @RequiresPermissions("quality:qcGoalDistribute:query") -// @GetMapping(value = "/{id}") -// public AjaxResult getInfo(@PathVariable("id") String id) { -// return success(qcGoalDistributeService.selectQcGoalDistributeById(id)); -// } -// -// /** -// * 新增质量目标分配 -// */ -// @Log(title = "质量目标分配", businessType = BusinessType.INSERT) -// @PostMapping -// public AjaxResult add(@RequestBody QcGoalDistribute qcGoalDistribute) { -// return toAjax(qcGoalDistributeService.insertQcGoalDistribute(qcGoalDistribute)); -// } -// -// /** -// * 修改质量目标分配 -// */ -// @RequiresPermissions("quality:qcGoalDistribute:edit") -// @Log(title = "质量目标分配", businessType = BusinessType.UPDATE) -// @PutMapping -// public AjaxResult edit(@RequestBody QcGoalDistribute qcGoalDistribute) { -// return toAjax(qcGoalDistributeService.updateQcGoalDistribute(qcGoalDistribute)); -// } -// -// /** -// * 删除质量目标分配 -// */ -// @RequiresPermissions("quality:qcGoalDistribute:remove") -// @Log(title = "质量目标分配", businessType = BusinessType.DELETE) -// @DeleteMapping("/{ids}") -// public AjaxResult remove(@PathVariable String[] ids) { -// return toAjax(qcGoalDistributeService.deleteQcGoalDistributeByIds(ids)); -// } -// /** -// * 获取未分配供应商数据 -// */ -// @GetMapping(value = "/getLeftList") -// public TableDataInfo getLeftList(QcGoalDistribute qcGoalDistribute) { -// startPage(); -// List list = qcGoalDistributeService.getLeftList(qcGoalDistribute); -// return getDataTable(list); -// } -// -// /** -// * 获取已分配供应商数据 -// */ -// @GetMapping(value = "/getRightList") -// public TableDataInfo getRightList(QcGoalDistribute qcGoalDistribute) { -// startPage(); -// List list = qcGoalDistributeService.getRightList(qcGoalDistribute); -// return getDataTable(list); -// } + @Autowired + private IQcGoalDistributeService qcGoalDistributeService; + +/** + * 查询质量目标分配列表 + */ +@RequiresPermissions("quality:qcGoalDistribute:list") +@GetMapping("/list") + public TableDataInfo list(QcGoalDistribute qcGoalDistribute) { + startPage(); + List list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute); + return getDataTable(list); + } + + /** + * 导出质量目标分配列表 + */ + @RequiresPermissions("quality:qcGoalDistribute:export") + @Log(title = "质量目标分配", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, QcGoalDistribute qcGoalDistribute) { + List list = qcGoalDistributeService.selectQcGoalDistributeList(qcGoalDistribute); + ExcelUtil util = new ExcelUtil(QcGoalDistribute. class); + util.exportExcel(response, list, "质量目标分配数据"); + } + + /** + * 获取质量目标分配详细信息 + */ + @RequiresPermissions("quality:qcGoalDistribute:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) { + return success(qcGoalDistributeService.selectQcGoalDistributeById(id)); + } + + /** + * 新增质量目标分配 + */ + @Log(title = "质量目标分配", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody QcGoalDistribute qcGoalDistribute) { + return toAjax(qcGoalDistributeService.insertQcGoalDistribute(qcGoalDistribute)); + } + + /** + * 修改质量目标分配 + */ + @RequiresPermissions("quality:qcGoalDistribute:edit") + @Log(title = "质量目标分配", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody QcGoalDistribute qcGoalDistribute) { + return toAjax(qcGoalDistributeService.updateQcGoalDistribute(qcGoalDistribute)); + } + + /** + * 删除质量目标分配 + */ + @RequiresPermissions("quality:qcGoalDistribute:remove") + @Log(title = "质量目标分配", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) { + return toAjax(qcGoalDistributeService.deleteQcGoalDistributeByIds(ids)); + } + /** + * 获取未分配供应商数据 + */ + @GetMapping(value = "/getLeftList") + public TableDataInfo getLeftList(QcGoalDistribute qcGoalDistribute) { + startPage(); + List list = qcGoalDistributeService.getLeftList(qcGoalDistribute); + return getDataTable(list); + } + + /** + * 获取已分配供应商数据 + */ + @GetMapping(value = "/getRightList") + public TableDataInfo getRightList(QcGoalDistribute qcGoalDistribute) { + startPage(); + List list = qcGoalDistributeService.getRightList(qcGoalDistribute); + return getDataTable(list); + } + + /** + * 获取未分配供应商数据 + */ + @GetMapping(value = "/getProductLeftList") + public TableDataInfo getProductLeftList(QcGoalDistribute qcGoalDistribute) { + startPage(); + List list = qcGoalDistributeService.getProductLeftList(qcGoalDistribute); + return getDataTable(list); + } + + /** + * 获取已分配供应商数据 + */ + @GetMapping(value = "/getProductRightList") + public TableDataInfo getProductRightList(QcGoalDistribute qcGoalDistribute) { + startPage(); + List list = qcGoalDistributeService.getProductRightList(qcGoalDistribute); + return getDataTable(list); + } } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcGoalDistributeMapper.java b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcGoalDistributeMapper.java index 6a550b19a..3d1918dba 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcGoalDistributeMapper.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/mapper/QcGoalDistributeMapper.java @@ -66,5 +66,8 @@ public interface QcGoalDistributeMapper { public List getGoalDistributeUndo(QcGoalDistribute qcGoalDistribute); public List getGoalDistributeDo(QcGoalDistribute qcGoalDistribute); + public List getProductUndo(QcGoalDistribute qcGoalDistribute); + public List getProductDo(QcGoalDistribute qcGoalDistribute); + } diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalDistributeService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalDistributeService.java new file mode 100644 index 000000000..912c04a26 --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalDistributeService.java @@ -0,0 +1,67 @@ +package com.op.quality.service; + +import java.util.List; + +import com.op.quality.domain.QcGoalDistribute; + +/** + * 质量目标分配Service接口 + * + * @author Open Platform + * @date 2024-03-07 + */ +public interface IQcGoalDistributeService { + /** + * 查询质量目标分配 + * + * @param id 质量目标分配主键 + * @return 质量目标分配 + */ + public QcGoalDistribute selectQcGoalDistributeById(String id); + + /** + * 查询质量目标分配列表 + * + * @param qcGoalDistribute 质量目标分配 + * @return 质量目标分配集合 + */ + public List selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute); + + /** + * 新增质量目标分配 + * + * @param qcGoalDistribute 质量目标分配 + * @return 结果 + */ + public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute); + + /** + * 修改质量目标分配 + * + * @param qcGoalDistribute 质量目标分配 + * @return 结果 + */ + public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute); + + /** + * 批量删除质量目标分配 + * + * @param ids 需要删除的质量目标分配主键集合 + * @return 结果 + */ + public int deleteQcGoalDistributeByIds(String[] ids); + + /** + * 删除质量目标分配信息 + * + * @param id 质量目标分配主键 + * @return 结果 + */ + public int deleteQcGoalDistributeById(String id); + + + public List getLeftList(QcGoalDistribute qcGoalDistribute); + public List getRightList(QcGoalDistribute qcGoalDistribute); + public List getProductLeftList(QcGoalDistribute qcGoalDistribute); + public List getProductRightList(QcGoalDistribute qcGoalDistribute); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalService.java b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalService.java new file mode 100644 index 000000000..06948040e --- /dev/null +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/IQcGoalService.java @@ -0,0 +1,85 @@ +package com.op.quality.service; + +import java.util.List; + +import com.op.quality.domain.QcGoal; +import com.op.quality.domain.vo.TreeSelect; + +/** + * 质量目标Service接口 + * + * @author Open Platform + * @date 2024-03-04 + */ +public interface IQcGoalService { + /** + * 查询质量目标 + * + * @param id 质量目标主键 + * @return 质量目标 + */ + public QcGoal selectQcGoalById(String id); + + /** + * 查询质量目标列表 + * + * @param qcGoal 质量目标 + * @return 质量目标集合 + */ + public List selectQcGoalList(QcGoal qcGoal); + + /** + * 查询质量目标二级数据 + * @param goal + * @return + */ + public List selectChildrenByParent(QcGoal goal); + + /** + * 构建质量目标下拉树 + * @param qcGoals + * @return + */ + public List buildQcGoalTreeSelect(List qcGoals); + + /** + * 新增质量目标 + * + * @param qcGoal 质量目标 + * @return 结果 + */ + public int insertQcGoal(QcGoal qcGoal); + + public List generate(String id); + + /** + * 修改质量目标 + * + * @param qcGoal 质量目标 + * @return 结果 + */ + public int updateQcGoal(QcGoal qcGoal); + + /** + * 批量删除质量目标 + * + * @param ids 需要删除的质量目标主键集合 + * @return 结果 + */ + public int deleteQcGoalByIds(String[] ids); + + /** + * 删除质量目标信息 + * + * @param id 质量目标主键 + * @return 结果 + */ + public int deleteQcGoalById(String id); + + /** + * 构建质量目标树结构 + * @param qcGoals + * @return + */ + public List buildGoalTree(List qcGoals); +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalDistributeServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalDistributeServiceImpl.java index a9eba05f3..993b39876 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalDistributeServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalDistributeServiceImpl.java @@ -1,153 +1,174 @@ -//package com.op.quality.service.impl; -// -//import java.util.Date; -//import java.util.List; -// -//import com.baomidou.dynamic.datasource.annotation.DS; -//import com.op.common.core.utils.DateUtils; -//import com.op.common.core.utils.StringUtils; -//import com.op.common.core.utils.uuid.IdUtils; -//import com.op.common.security.utils.SecurityUtils; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Service; -//import com.op.quality.mapper.QcGoalDistributeMapper; -//import com.op.quality.domain.QcGoalDistribute; -//import com.op.quality.service.IQcGoalDistributeService; -//import org.springframework.web.context.request.RequestContextHolder; -//import org.springframework.web.context.request.ServletRequestAttributes; -// -//import javax.servlet.http.HttpServletRequest; -// -///** -// * 质量目标分配Service业务层处理 -// * -// * @author Open Platform -// * @date 2024-03-07 -// */ -//@Service -//public class QcGoalDistributeServiceImpl implements IQcGoalDistributeService { -// @Autowired -// private QcGoalDistributeMapper qcGoalDistributeMapper; -// -// /** -// * 查询质量目标分配 -// * -// * @param id 质量目标分配主键 -// * @return 质量目标分配 -// */ -// @Override -// @DS("#header.poolName") -// public QcGoalDistribute selectQcGoalDistributeById(String id) { -// return qcGoalDistributeMapper.selectQcGoalDistributeById(id); -// } -// -// /** -// * 查询质量目标分配列表 -// * -// * @param qcGoalDistribute 质量目标分配 -// * @return 质量目标分配 -// */ -// @Override -// @DS("#header.poolName") -// public List selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute) { -// return qcGoalDistributeMapper.selectQcGoalDistributeList(qcGoalDistribute); -// } -// -// /** -// * 新增质量目标分配 -// * -// * @param qcGoalDistribute 质量目标分配 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute) { -// -// if (StringUtils.isNotEmpty(qcGoalDistribute.getBelongGoalId())) { -// qcGoalDistributeMapper.deleteQcGoalDistributeByBelongId(qcGoalDistribute.getBelongGoalId()); -// } -// int count = 0; -// if (qcGoalDistribute.getSelectedValues().size() > 0){ -// QcGoalDistribute dto = null; -// Date now = DateUtils.getNowDate(); -// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); -// String key = "#header.poolName"; -// String factoryCode = request.getHeader(key.substring(8)).replace("ds_", ""); -// for (String supplierCode : qcGoalDistribute.getSelectedValues()) { -// dto = new QcGoalDistribute(); -// dto.setId(IdUtils.fastSimpleUUID()); -// dto.setCreateTime(now); -// dto.setCreateBy(SecurityUtils.getUsername()); -// dto.setBelongGoalId(qcGoalDistribute.getBelongGoalId()); -// dto.setSupplierCode(supplierCode); -// dto.setFactoryCode(factoryCode); -// count += qcGoalDistributeMapper.insertQcGoalDistribute(dto); -// } -// }else { -// count = 1; -// } -// return count; -// } -// -// /** -// * 修改质量目标分配 -// * -// * @param qcGoalDistribute 质量目标分配 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute) { -// qcGoalDistribute.setUpdateTime(DateUtils.getNowDate()); -// return qcGoalDistributeMapper.updateQcGoalDistribute(qcGoalDistribute); -// } -// -// /** -// * 批量删除质量目标分配 -// * -// * @param ids 需要删除的质量目标分配主键 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int deleteQcGoalDistributeByIds(String[] ids) { -// return qcGoalDistributeMapper.deleteQcGoalDistributeByIds(ids); -// } -// -// /** -// * 删除质量目标分配信息 -// * -// * @param id 质量目标分配主键 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int deleteQcGoalDistributeById(String id) { -// return qcGoalDistributeMapper.deleteQcGoalDistributeById(id); -// } -// -// @Override -// @DS("#header.poolName") -// public List getLeftList(QcGoalDistribute qcGoalDistribute) { -// List dto = qcGoalDistributeMapper.getGoalDistributeUndo(qcGoalDistribute); -// List selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute); -// dto.addAll(selected); -// dto.forEach(item -> { -// item.setKey(item.getSupplierCode()); -// }); -// return dto; -// } -// -// @Override -// @DS("#header.poolName") -// public List getRightList(QcGoalDistribute qcGoalDistribute) { -// List selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute); -// selected.forEach(item -> { -// item.setKey(item.getSupplierCode()); -// }); -// return selected; -// } -// -// -// -//} +package com.op.quality.service.impl; + +import java.util.Date; +import java.util.List; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.StringUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.op.quality.mapper.QcGoalDistributeMapper; +import com.op.quality.domain.QcGoalDistribute; +import com.op.quality.service.IQcGoalDistributeService; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 质量目标分配Service业务层处理 + * + * @author Open Platform + * @date 2024-03-07 + */ +@Service +public class QcGoalDistributeServiceImpl implements IQcGoalDistributeService { + @Autowired + private QcGoalDistributeMapper qcGoalDistributeMapper; + + /** + * 查询质量目标分配 + * + * @param id 质量目标分配主键 + * @return 质量目标分配 + */ + @Override + @DS("#header.poolName") + public QcGoalDistribute selectQcGoalDistributeById(String id) { + return qcGoalDistributeMapper.selectQcGoalDistributeById(id); + } + + /** + * 查询质量目标分配列表 + * + * @param qcGoalDistribute 质量目标分配 + * @return 质量目标分配 + */ + @Override + @DS("#header.poolName") + public List selectQcGoalDistributeList(QcGoalDistribute qcGoalDistribute) { + return qcGoalDistributeMapper.selectQcGoalDistributeList(qcGoalDistribute); + } + + /** + * 新增质量目标分配 + * + * @param qcGoalDistribute 质量目标分配 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int insertQcGoalDistribute(QcGoalDistribute qcGoalDistribute) { + + if (StringUtils.isNotEmpty(qcGoalDistribute.getBelongGoalId())) { + qcGoalDistributeMapper.deleteQcGoalDistributeByBelongId(qcGoalDistribute.getBelongGoalId()); + } + int count = 0; + if (qcGoalDistribute.getSelectedValues().size() > 0){ + QcGoalDistribute dto = null; + Date now = DateUtils.getNowDate(); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_", ""); + for (String supplierCode : qcGoalDistribute.getSelectedValues()) { + dto = new QcGoalDistribute(); + dto.setId(IdUtils.fastSimpleUUID()); + dto.setCreateTime(now); + dto.setCreateBy(SecurityUtils.getUsername()); + dto.setBelongGoalId(qcGoalDistribute.getBelongGoalId()); + dto.setSupplierCode(supplierCode); + dto.setFactoryCode(factoryCode); + count += qcGoalDistributeMapper.insertQcGoalDistribute(dto); + } + }else { + count = 1; + } + return count; + } + + /** + * 修改质量目标分配 + * + * @param qcGoalDistribute 质量目标分配 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateQcGoalDistribute(QcGoalDistribute qcGoalDistribute) { + qcGoalDistribute.setUpdateTime(DateUtils.getNowDate()); + return qcGoalDistributeMapper.updateQcGoalDistribute(qcGoalDistribute); + } + + /** + * 批量删除质量目标分配 + * + * @param ids 需要删除的质量目标分配主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcGoalDistributeByIds(String[] ids) { + return qcGoalDistributeMapper.deleteQcGoalDistributeByIds(ids); + } + + /** + * 删除质量目标分配信息 + * + * @param id 质量目标分配主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcGoalDistributeById(String id) { + return qcGoalDistributeMapper.deleteQcGoalDistributeById(id); + } + + @Override + @DS("#header.poolName") + public List getLeftList(QcGoalDistribute qcGoalDistribute) { + List dto = qcGoalDistributeMapper.getGoalDistributeUndo(qcGoalDistribute); + List selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute); + dto.addAll(selected); + dto.forEach(item -> { + item.setKey(item.getSupplierCode()); + }); + return dto; + } + + @Override + @DS("#header.poolName") + public List getRightList(QcGoalDistribute qcGoalDistribute) { + List selected = qcGoalDistributeMapper.getGoalDistributeDo(qcGoalDistribute); + selected.forEach(item -> { + item.setKey(item.getSupplierCode()); + }); + return selected; + } + @Override + @DS("#header.poolName") + public List getProductLeftList(QcGoalDistribute qcGoalDistribute) { + List dto = qcGoalDistributeMapper.getProductUndo(qcGoalDistribute); + List selected = qcGoalDistributeMapper.getProductDo(qcGoalDistribute); + dto.addAll(selected); + dto.forEach(item -> { + item.setKey(item.getSupplierCode()); + }); + return dto; + } + + @Override + @DS("#header.poolName") + public List getProductRightList(QcGoalDistribute qcGoalDistribute) { + List selected = qcGoalDistributeMapper.getProductDo(qcGoalDistribute); + selected.forEach(item -> { + item.setKey(item.getSupplierCode()); + }); + return selected; + } + + + +} diff --git a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalServiceImpl.java b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalServiceImpl.java index 6f2744439..f3aa0a00c 100644 --- a/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalServiceImpl.java +++ b/op-modules/op-quality/src/main/java/com/op/quality/service/impl/QcGoalServiceImpl.java @@ -1,245 +1,245 @@ -//package com.op.quality.service.impl; -// -//import java.math.BigDecimal; -//import java.util.ArrayList; -//import java.util.Date; -//import java.util.Iterator; -//import java.util.List; -//import java.util.stream.Collectors; -// -//import com.baomidou.dynamic.datasource.annotation.DS; -//import com.op.common.core.utils.DateUtils; -//import com.op.common.security.utils.SecurityUtils; -//import com.op.quality.domain.vo.TreeSelect; -//import com.sun.xml.bind.v2.TODO; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.stereotype.Service; -//import com.op.quality.mapper.QcGoalMapper; -//import com.op.quality.domain.QcGoal; -//import com.op.quality.service.IQcGoalService; -//import org.springframework.util.ObjectUtils; -//import org.springframework.web.context.request.RequestContextHolder; -//import org.springframework.web.context.request.ServletRequestAttributes; -// -//import javax.servlet.http.HttpServletRequest; -// -///** -// * 质量目标Service业务层处理 -// * -// * @author Open Platform -// * @date 2024-03-04 -// */ -//@Service -//public class QcGoalServiceImpl implements IQcGoalService { -// @Autowired -// private QcGoalMapper qcGoalMapper; -// -// /** -// * 查询质量目标 -// * -// * @param id 质量目标主键 -// * @return 质量目标 -// */ -// @Override -// @DS("#header.poolName") -// public QcGoal selectQcGoalById(String id) { -// return qcGoalMapper.selectQcGoalById(id); -// } -// -// /** -// * 查询质量目标列表 -// * -// * @param qcGoal 质量目标 -// * @return 质量目标 -// */ -// @Override -// @DS("#header.poolName") -// public List selectQcGoalList(QcGoal qcGoal) { -// List qcGoals = qcGoalMapper.selectQcGoalList(qcGoal); -// for (QcGoal item : qcGoals) { -// item.setHasChildren(true); -// } -// return qcGoals; -// } -// -// @Override -// @DS("#header.poolName") -// public List selectChildrenByParent(QcGoal goal) { -// return qcGoalMapper.selectChildrenByParent(goal); -// } -// -// @Override -// @DS("#header.poolName") -// public List buildQcGoalTreeSelect(List qcGoals) { -// List qcGoalTrees = buildGoalTree(qcGoals); -// return qcGoalTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); -// } -// -// /** -// * 新增质量目标 -// * -// * @param qcGoal 质量目标 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int insertQcGoal(QcGoal qcGoal) { -// qcGoal.setCreateTime(DateUtils.getNowDate()); -// qcGoal.setCreateBy(SecurityUtils.getUsername()); -// -// qcGoal.setId(getSerialNumber(qcGoal)); -// qcGoal.setFactoryCode(getFactoryCode()); -// qcGoal.setParentGoal("0"); -// -// return qcGoalMapper.insertQcGoal(qcGoal); -// } -// -// @Override -// @DS("#header.poolName") -// public List generate(String id) { -// QcGoal goal = qcGoalMapper.selectQcGoalById(id); -// List genResult = new ArrayList<>(); -// -// // 提前分配大小,有助于减少不必要的计算和内存分配,从而提高代码的性能。 -// String goalYm = goal.getGoalYm(); -// BigDecimal nookQualityRate = goal.getNookQualityRate(); -// BigDecimal nookRate = goal.getNookRate(); -// String checkType = goal.getCheckType(); -// String typeCode = goal.getTypeCode(); -// String factoryCode = getFactoryCode(); -// String username = SecurityUtils.getUsername(); -// Date nowDate = DateUtils.getNowDate(); -// String parentGoal = goal.getId(); -// -// -// int liushuiNum = qcGoalMapper.getTodayMaxNum(goal); -// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); -// -// int month = 12; -// for (int i = 1; i <= month; i++) { -// QcGoal monthGoal = new QcGoal(); -// -// String liushuiStr = String.format("%04d", liushuiNum+i-1); -// monthGoal.setId(dateNumber+liushuiStr); -// String mon = String.format("%02d",i); -// monthGoal.setGoalYm(goalYm+"-"+mon); -// monthGoal.setGoalType("mm"); -// monthGoal.setNookQualityRate(nookQualityRate); -// monthGoal.setNookRate(nookRate); -// monthGoal.setCheckType(checkType); -// monthGoal.setTypeCode(typeCode); -// monthGoal.setScope(goal.getScope()); -// monthGoal.setCreateTime(nowDate); -// monthGoal.setCreateBy(username); -// monthGoal.setFactoryCode(factoryCode); -// monthGoal.setParentGoal(parentGoal); -// genResult.add(monthGoal); -// } -// // 批量插入 -// int flag = qcGoalMapper.insertQcGoalList(genResult); -// if (flag > 0) { -// return genResult; -// }else { -// return goal.getChildren(); -// } -// -// } -// -// /** -// * 修改质量目标 -// * -// * @param qcGoal 质量目标 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int updateQcGoal(QcGoal qcGoal) { -// qcGoal.setUpdateTime(DateUtils.getNowDate()); -// qcGoal.setUpdateBy(SecurityUtils.getUsername()); -// return qcGoalMapper.updateQcGoal(qcGoal); -// } -// -// /** -// * 批量删除质量目标 -// * -// * @param ids 需要删除的质量目标主键 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int deleteQcGoalByIds(String[] ids) { -// boolean flag = false; -// for (String id : ids) { -// QcGoal goal = new QcGoal(); -// goal.setParentGoal(id); -// List hasChildren = qcGoalMapper.selectChildrenByParent(goal); -// if (hasChildren.size() > 0) { -// flag = true; -// break; -// } -// } -// if (flag) { -// return 0; -// }else { -// return qcGoalMapper.deleteQcGoalByIds(ids); -// } -// } -// -// /** -// * 删除质量目标信息 -// * -// * @param id 质量目标主键 -// * @return 结果 -// */ -// @Override -// @DS("#header.poolName") -// public int deleteQcGoalById(String id) { -// return qcGoalMapper.deleteQcGoalById(id); -// } -// -// @Override -// public List buildGoalTree(List qcGoals) { -// List returnList = new ArrayList<>(); -// List tempList = qcGoals.stream().map(QcGoal::getId).collect(Collectors.toList()); -// for (Iterator iterator = qcGoals.iterator(); iterator.hasNext(); ) { -// QcGoal qcGoal = (QcGoal) iterator.next(); -// //如果是顶级节点,遍历父节点的所有子节点 -// if (!tempList.contains(qcGoal.getParentGoal())) { -// List childList = getChildList(qcGoals,qcGoal); -// qcGoal.setChildren(childList); -// returnList.add(qcGoal); -// } -// } -// if (returnList.isEmpty()) { -// returnList = qcGoals; -// } -// return returnList; -// } -// -// private List getChildList(List list, QcGoal t) { -// List tlist = new ArrayList<>(); -// Iterator it = list.iterator(); -// while (it.hasNext()) { -// QcGoal goal = (QcGoal) it.next(); -// if (goal.getParentGoal().equals(t.getId())){ -// tlist.add(goal); -// } -// } -// return tlist; -// } -// -// @DS("#header.poolName") -// private String getSerialNumber(QcGoal qcGoal) { -// int liushuiNum = qcGoalMapper.getTodayMaxNum(qcGoal); -// String liushuiStr = String.format("%04d", liushuiNum); -// String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); -// return dateNumber + liushuiStr; -// } -// @DS("#header.poolName") -// private String getFactoryCode() { -// HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); -// String key = "#header.poolName"; -// return request.getHeader(key.substring(8)).replace("ds_", ""); -// } -// -//} +package com.op.quality.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +import com.baomidou.dynamic.datasource.annotation.DS; +import com.op.common.core.utils.DateUtils; +import com.op.common.security.utils.SecurityUtils; +import com.op.quality.domain.vo.TreeSelect; +import com.sun.xml.bind.v2.TODO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.op.quality.mapper.QcGoalMapper; +import com.op.quality.domain.QcGoal; +import com.op.quality.service.IQcGoalService; +import org.springframework.util.ObjectUtils; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * 质量目标Service业务层处理 + * + * @author Open Platform + * @date 2024-03-04 + */ +@Service +public class QcGoalServiceImpl implements IQcGoalService { + @Autowired + private QcGoalMapper qcGoalMapper; + + /** + * 查询质量目标 + * + * @param id 质量目标主键 + * @return 质量目标 + */ + @Override + @DS("#header.poolName") + public QcGoal selectQcGoalById(String id) { + return qcGoalMapper.selectQcGoalById(id); + } + + /** + * 查询质量目标列表 + * + * @param qcGoal 质量目标 + * @return 质量目标 + */ + @Override + @DS("#header.poolName") + public List selectQcGoalList(QcGoal qcGoal) { + List qcGoals = qcGoalMapper.selectQcGoalList(qcGoal); + for (QcGoal item : qcGoals) { + item.setHasChildren(true); + } + return qcGoals; + } + + @Override + @DS("#header.poolName") + public List selectChildrenByParent(QcGoal goal) { + return qcGoalMapper.selectChildrenByParent(goal); + } + + @Override + @DS("#header.poolName") + public List buildQcGoalTreeSelect(List qcGoals) { + List qcGoalTrees = buildGoalTree(qcGoals); + return qcGoalTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); + } + + /** + * 新增质量目标 + * + * @param qcGoal 质量目标 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int insertQcGoal(QcGoal qcGoal) { + qcGoal.setCreateTime(DateUtils.getNowDate()); + qcGoal.setCreateBy(SecurityUtils.getUsername()); + + qcGoal.setId(getSerialNumber(qcGoal)); + qcGoal.setFactoryCode(getFactoryCode()); + qcGoal.setParentGoal("0"); + + return qcGoalMapper.insertQcGoal(qcGoal); + } + + @Override + @DS("#header.poolName") + public List generate(String id) { + QcGoal goal = qcGoalMapper.selectQcGoalById(id); + List genResult = new ArrayList<>(); + + // 提前分配大小,有助于减少不必要的计算和内存分配,从而提高代码的性能。 + String goalYm = goal.getGoalYm(); + BigDecimal nookQualityRate = goal.getNookQualityRate(); + BigDecimal nookRate = goal.getNookRate(); + String checkType = goal.getCheckType(); + String typeCode = goal.getTypeCode(); + String factoryCode = getFactoryCode(); + String username = SecurityUtils.getUsername(); + Date nowDate = DateUtils.getNowDate(); + String parentGoal = goal.getId(); + + + int liushuiNum = qcGoalMapper.getTodayMaxNum(goal); + String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + + int month = 12; + for (int i = 1; i <= month; i++) { + QcGoal monthGoal = new QcGoal(); + + String liushuiStr = String.format("%04d", liushuiNum+i-1); + monthGoal.setId(dateNumber+liushuiStr); + String mon = String.format("%02d",i); + monthGoal.setGoalYm(goalYm+"-"+mon); + monthGoal.setGoalType("mm"); + monthGoal.setNookQualityRate(nookQualityRate); + monthGoal.setNookRate(nookRate); + monthGoal.setCheckType(checkType); + monthGoal.setTypeCode(typeCode); + monthGoal.setScope(goal.getScope()); + monthGoal.setCreateTime(nowDate); + monthGoal.setCreateBy(username); + monthGoal.setFactoryCode(factoryCode); + monthGoal.setParentGoal(parentGoal); + genResult.add(monthGoal); + } + // 批量插入 + int flag = qcGoalMapper.insertQcGoalList(genResult); + if (flag > 0) { + return genResult; + }else { + return goal.getChildren(); + } + + } + + /** + * 修改质量目标 + * + * @param qcGoal 质量目标 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int updateQcGoal(QcGoal qcGoal) { + qcGoal.setUpdateTime(DateUtils.getNowDate()); + qcGoal.setUpdateBy(SecurityUtils.getUsername()); + return qcGoalMapper.updateQcGoal(qcGoal); + } + + /** + * 批量删除质量目标 + * + * @param ids 需要删除的质量目标主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcGoalByIds(String[] ids) { + boolean flag = false; + for (String id : ids) { + QcGoal goal = new QcGoal(); + goal.setParentGoal(id); + List hasChildren = qcGoalMapper.selectChildrenByParent(goal); + if (hasChildren.size() > 0) { + flag = true; + break; + } + } + if (flag) { + return 0; + }else { + return qcGoalMapper.deleteQcGoalByIds(ids); + } + } + + /** + * 删除质量目标信息 + * + * @param id 质量目标主键 + * @return 结果 + */ + @Override + @DS("#header.poolName") + public int deleteQcGoalById(String id) { + return qcGoalMapper.deleteQcGoalById(id); + } + + @Override + public List buildGoalTree(List qcGoals) { + List returnList = new ArrayList<>(); + List tempList = qcGoals.stream().map(QcGoal::getId).collect(Collectors.toList()); + for (Iterator iterator = qcGoals.iterator(); iterator.hasNext(); ) { + QcGoal qcGoal = (QcGoal) iterator.next(); + //如果是顶级节点,遍历父节点的所有子节点 + if (!tempList.contains(qcGoal.getParentGoal())) { + List childList = getChildList(qcGoals,qcGoal); + qcGoal.setChildren(childList); + returnList.add(qcGoal); + } + } + if (returnList.isEmpty()) { + returnList = qcGoals; + } + return returnList; + } + + private List getChildList(List list, QcGoal t) { + List tlist = new ArrayList<>(); + Iterator it = list.iterator(); + while (it.hasNext()) { + QcGoal goal = (QcGoal) it.next(); + if (goal.getParentGoal().equals(t.getId())){ + tlist.add(goal); + } + } + return tlist; + } + + @DS("#header.poolName") + private String getSerialNumber(QcGoal qcGoal) { + int liushuiNum = qcGoalMapper.getTodayMaxNum(qcGoal); + String liushuiStr = String.format("%04d", liushuiNum); + String dateNumber = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); + return dateNumber + liushuiStr; + } + @DS("#header.poolName") + private String getFactoryCode() { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + return request.getHeader(key.substring(8)).replace("ds_", ""); + } + +} diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml index 28de20adf..a24887afe 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcCheckTaskProduceMapper.xml @@ -110,7 +110,8 @@ and qct.check_no = #{checkNo} and qct.income_batch_no = #{incomeBatchNo} and qct.order_no = #{orderNo} - and qct.material_code = #{materialCode} + and qct.material_code like concat('%', + #{materialCode}, '%') and qct.material_name like concat('%', #{materialName}, '%') diff --git a/op-modules/op-quality/src/main/resources/mapper/quality/QcGoalDistributeMapper.xml b/op-modules/op-quality/src/main/resources/mapper/quality/QcGoalDistributeMapper.xml index 812578b74..c09bd8eba 100644 --- a/op-modules/op-quality/src/main/resources/mapper/quality/QcGoalDistributeMapper.xml +++ b/op-modules/op-quality/src/main/resources/mapper/quality/QcGoalDistributeMapper.xml @@ -214,5 +214,37 @@ + + + + From 0128967ab90612f3c93c77174880722b999bb643 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Wed, 13 Mar 2024 15:02:10 +0800 Subject: [PATCH 4/6] =?UTF-8?q?2024-3-13=20=E5=9F=BA=E7=A1=80=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=AE=A1=E7=90=86-=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E5=A2=9E=E5=8A=A0sap=5Fcode=E5=92=8Csap=5Fname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/wms/domain/BaseEquipment.java | 26 +++++++++++++++++++ .../mapper/wms/BaseEquipmentMapper.xml | 15 +++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java index 22c81ff62..22ba6574a 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseEquipment.java @@ -346,6 +346,16 @@ public class BaseEquipment extends BaseEntity { @Excel(name = "计量单位") private String unitMeasurement; + //新增SAP字段 + /** + * SAP线体编码 + */ + private String sapCode; + /** + * SAP线体名称 + */ + private String sapName; + private String imageFileList; private String barCodeFileList; @@ -1134,6 +1144,22 @@ public class BaseEquipment extends BaseEntity { return unitMeasurement; } + //SAP线体编码 + public void setSapCode(String sapCode) { + this.sapCode = sapCode; + } + public String getSapCode() { + return sapCode; + } + + //SAP线体名称 + public void setSapName(String sapName) { + this.sapName = sapName; + } + public String getSapName() { + return sapName; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml index a4fbd98f0..cf87e858f 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseEquipmentMapper.xml @@ -54,7 +54,8 @@ - + + @@ -175,7 +176,9 @@ asset_description, equipment_number, inventory_number, - unit_measurement + unit_measurement, + sap_code, + sap_name from base_equipment @@ -251,6 +254,8 @@ and equipment_number = #{equipmentNumber} and inventory_number = #{inventoryNumber} and unit_measurement = #{unitMeasurement} + and sap_code = #{sapCode} + and sap_name = #{sapName} and del_flag ='0' @@ -318,6 +323,8 @@ equipment_number, inventory_number, unit_measurement, + sap_code, + sap_name, #{equipmentCode}, @@ -368,6 +375,8 @@ #{equipmentNumber}, #{inventoryNumber}, #{unitMeasurement}, + #{sapCode}, + #{sapName}, @@ -427,6 +436,8 @@ equipment_number = #{equipmentNumber}, inventory_number = #{inventoryNumber}, unit_measurement = #{unitMeasurement}, + sap_code = #{sapCode}, + sap_name = #{sapName}, where equipment_id = #{equipmentId} From 916d9d86ff91deab5f56e69ff1cb69415df19de3 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Wed, 13 Mar 2024 16:40:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?2024-3-13=20=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=B3=BB=E7=BB=9F-=E8=AE=BE=E5=A4=87=E7=9C=8B?= =?UTF-8?q?=E6=9D=BF-=E8=AE=BE=E5=A4=87=E6=9C=89=E6=95=88=E5=88=A9?= =?UTF-8?q?=E7=94=A8=E7=8E=87=E5=85=AC=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/device/service/impl/DeviceInterfaceServiceImpl.java | 2 +- .../main/resources/mapper/device/DeviceInterfaceMapper.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java index 238a36b6f..90224224e 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceInterfaceServiceImpl.java @@ -52,7 +52,7 @@ public class DeviceInterfaceServiceImpl implements IDeviceInterfaceService { /** * 获取设备信息 - * 故障停机率:(设备停机时间总和/一定时间内运行总时间(年)) + * 故障停机率:(设备停机时间总和/一定时间内运行总时间(今年运行的时间)) * 设备有效利用率:(实际产量/理论产量)改为:一定天数内该设备的总开机时间/(天数*24小时) * * @return diff --git a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml index 05bcf3876..e1cd6ab82 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/DeviceInterfaceMapper.xml @@ -48,8 +48,8 @@ be.equipment_name AS 'equipmentName', be.equipment_status AS 'equipmentStatus', be.department AS 'department', - ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.actual_operation_time AS FLOAT)),2) AS 'failureRate', - CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100 / (365*24) AS DECIMAL(18,2)) AS 'utilizationRatio' + ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.operation_time AS FLOAT)),2) AS 'failureRate', + CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100/(COUNT(eo.actual_operation_time)*24) AS DECIMAL(18,2)) AS 'utilizationRatio' FROM equ_operation eo LEFT JOIN base_equipment be ON eo.equipment_code = be.equipment_code From 5fac9b8abe76a3337b57527a2796603eb2e1b28a Mon Sep 17 00:00:00 2001 From: A0010407 Date: Wed, 13 Mar 2024 17:59:39 +0800 Subject: [PATCH 6/6] =?UTF-8?q?2024-3-13=20=E8=AE=BE=E5=A4=87=E6=A8=A1?= =?UTF-8?q?=E5=9D=97-=E7=82=B9=E6=A3=80=E6=8F=90=E7=A4=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/service/impl/EquSpotCheckServiceImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpotCheckServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpotCheckServiceImpl.java index 474cba85c..a8a8661d6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpotCheckServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquSpotCheckServiceImpl.java @@ -123,8 +123,9 @@ public class EquSpotCheckServiceImpl implements IEquSpotCheckService { * @return */ private AjaxResult formatEquItemCommon(List equPlanEquList, String planType, String message) { + //没有点检项的设备 + String equipmentList = ""; for (EquPlanEqu data : equPlanEquList) { - // 检查项名称临时对象 StringBuilder itemTempName = new StringBuilder(); @@ -169,9 +170,14 @@ public class EquSpotCheckServiceImpl implements IEquSpotCheckService { data.setItemTempName(itemTempName.toString());//处理好的检查项名称置入检查项名称(用于前端信息回显) } else { // 未查询到对应检查项信息 - return error(500, message); + equipmentList = equipmentList + '[' + data.getEquipmentCode() + "]"; } } + if(!equipmentList.equals("")){ + equipmentList = equipmentList + "设备未查询到对应检查项信息!"; + message = equipmentList; + return error(500, message); + } return success(equPlanEquList); }