From ad1db37d71ef251f0f73a0cc711739c9d1e512c2 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Wed, 14 Jul 2021 18:50:12 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ERP=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=96=B9=E6=B3=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/src/test/java/com/foreverwin/mesnac/console/TmdMc.java | 1 + 1 file changed, 1 insertion(+) diff --git a/console/src/test/java/com/foreverwin/mesnac/console/TmdMc.java b/console/src/test/java/com/foreverwin/mesnac/console/TmdMc.java index 2c3c7219..1c158b63 100644 --- a/console/src/test/java/com/foreverwin/mesnac/console/TmdMc.java +++ b/console/src/test/java/com/foreverwin/mesnac/console/TmdMc.java @@ -66,6 +66,7 @@ public class TmdMc { //调用WS ERPAPI.erpWebService().zmesProdordconf(inHolder, outHolder); + //状态: S|成功, E|失败 String status = outHolder.value[1].getRet(); String message = outHolder.value[1].getMsg(); System.out.println("ERP接口返回:状态:" + status + ",消息:" + message); From 21c22aa6d1b4fc4d63e317e7dcbef4eece5b9234 Mon Sep 17 00:00:00 2001 From: zpl Date: Wed, 14 Jul 2021 21:23:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/common/enums/HandleEnum.java | 3 +- .../production/controller/ToolController.java | 41 ++++++++++++++++ .../production/service/ToolService.java | 20 ++++++++ .../service/impl/ToolServiceImpl.java | 48 +++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java index cd842f93..fe15c86e 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/enums/HandleEnum.java @@ -131,8 +131,9 @@ public enum HandleEnum { LOAD_INVENTORY("LoadInventoryBO:","LoadInventoryBO:{0},{1}"), /**用户**/ - USR("UserBO","UserBO:{0},{1}"); + USR("UserBO","UserBO:{0},{1}"), + TOOL("ToolBO","ToolBO:{0},{1}"); private String prefix; private String pattern; diff --git a/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java b/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java index 976358d8..c76844ab 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/controller/ToolController.java @@ -1,10 +1,12 @@ package com.foreverwin.mesnac.production.controller; +import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.modular.core.util.R; import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.CommonMethods; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import oracle.jdbc.proxy.annotation.Post; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -127,4 +129,43 @@ public class ToolController { public R removeByIds(List ids){ return R.ok(toolService.removeByIds(ids)); } + + + /** + * 新增或者更新 + * @param tool 传递的实体 + * @return null 失败 实体成功 + */ + @PostMapping(value = "/saveOrUpdateOne") + public R saveOrUpdateOne(@RequestBody Tool tool) { + try{ + toolService.saveOrUpdateOne(tool); + }catch (Exception e){ + return R.failed("数据保存失败" + e.getMessage()); + } + return R.ok(); + } + + @ResponseBody + @GetMapping("/getOneToolByToolNo") + public R getOneToolByToolNo(String tool) { + try{ + return R.ok(toolService.getOneToolByToolNo(tool)); + }catch (Exception e){ + return R.failed("数据保存失败" + e.getMessage()); + } + } + + + @PostMapping("/deleteInspectionPlanByHandle") + public R deleteInspectionPlanByHandle(@RequestBody String tool){ + try { + toolService.deleteInspectionPlanByHandle(tool); + } catch (Exception e) { + R.failed("计划删除失败:" + e.getMessage()); + } + return R.ok(); + } + + } \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/ToolService.java b/production/src/main/java/com/foreverwin/mesnac/production/service/ToolService.java index c8e20659..944ce12b 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/ToolService.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/ToolService.java @@ -25,4 +25,24 @@ public interface ToolService extends IService { IPage selectPage(FrontPage frontPage, Tool tool); List selectList(Tool tool); + + /** + * 新增或更新 + * @param tool + */ + void saveOrUpdateOne(Tool tool); + + /** + * 根据编号,查询刀具 + * @param tool + * @return + */ + Tool getOneToolByToolNo(String tool); + + /** + * 删除刀具: + * 仅将状态进行修改,不会删除数据 + */ + void deleteInspectionPlanByHandle(String tool); + } \ No newline at end of file diff --git a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/ToolServiceImpl.java b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/ToolServiceImpl.java index 5088a403..04b03f38 100644 --- a/production/src/main/java/com/foreverwin/mesnac/production/service/impl/ToolServiceImpl.java +++ b/production/src/main/java/com/foreverwin/mesnac/production/service/impl/ToolServiceImpl.java @@ -1,5 +1,8 @@ package com.foreverwin.mesnac.production.service.impl; +import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.CommonMethods; import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -11,6 +14,7 @@ import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.List; /** *

@@ -42,5 +46,49 @@ public class ToolServiceImpl extends ServiceImpl implements To return super.list(queryWrapper); } + @Override + public void saveOrUpdateOne(Tool tool) { + String site = tool.getSite(); + String toolNo = tool.getTool(); + String handle = HandleEnum.TOOL.getHandle(site, toolNo); + String user = CommonMethods.getUser(); + tool.setHandle(handle); + Tool byId = toolMapper.selectById(handle); + if (byId != null){ + tool.setCreateUser(byId.getCreateUser()); + tool.setCreatedDateTime(byId.getCreatedDateTime()); + tool.setModifyUser(user); + tool.setModifiedDateTime(LocalDateTime.now()); + toolMapper.updateById(tool); + }else{ + tool.setCreateUser(user); + tool.setCreatedDateTime(LocalDateTime.now()); + toolMapper.insert(tool); + } + + } + + @Override + public Tool getOneToolByToolNo(String tool) { + String site = CommonMethods.getSite(); + String handle = HandleEnum.TOOL.getHandle(site, tool); + return toolMapper.selectById(handle); + } + + @Override + public void deleteInspectionPlanByHandle(String tool) { + String site = CommonMethods.getSite(); + String handle = HandleEnum.TOOL.getHandle(site, tool); + String user = CommonMethods.getUser(); + Tool byId = toolMapper.selectById(handle); + if (byId == null){ + throw BusinessException.build("刀具编号不存在!"); + } + byId.setStatus("N"); + byId.setModifyUser(user); + byId.setModifiedDateTime(LocalDateTime.now()); + toolMapper.updateById(byId); + } + } \ No newline at end of file