From c7479acfd9b5a876750b3641c60605c4128c6cb3 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Thu, 8 Jul 2021 14:16:43 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=BD=A6=E9=97=B4=E5=8F=91=E6=96=99?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/constant/DataImportConstant.java | 12 + .../constant/IntegrationTypeConstant.java | 7 + .../dataimport/client/ItemWSClient.java | 23 +- .../dataimport/client/NcCodeWSClient.java | 63 +++-- .../dataimport/client/NcGroupWSClient.java | 19 +- .../dataimport/handler/ItemHandler.java | 5 +- .../dataimport/handler/NCCodeHandler.java | 25 +- .../dataimport/handler/NCGroupHandler.java | 21 +- .../dataimport/handler/OperationHandler.java | 1 + .../handler/ResourceTypeHandler.java | 5 +- .../dataimport/handler/WorkCenterHandler.java | 5 +- .../service/MasterObjectDefine.java | 2 - .../controller/CallItemController.java | 113 ++++++++- .../mesnac/dispatch/dto/IssueItemDto.java | 80 ++++++ .../dispatch/mapper/CallItemMapper.java | 47 +++- .../mesnac/dispatch/model/CallItem.java | 47 +++- .../dispatch/service/CallItemService.java | 63 +++-- .../service/impl/CallItemServiceImpl.java | 63 +++-- .../service/impl/SfcDispatchServiceImpl.java | 9 + .../main/resources/mapper/CallItemMapper.xml | 231 +++++++++++++++++- .../mesnac/integration/dto/ItemBatchDto.java | 32 +-- .../dto/ItemBatchReceiveRequest.java | 24 +- .../service/impl/InterfaceServiceImpl.java | 63 +---- .../mesnac/meapi/model/ShopOrder.java | 8 +- 24 files changed, 776 insertions(+), 192 deletions(-) create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/dto/IssueItemDto.java diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/DataImportConstant.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/DataImportConstant.java index c0f82e7c..746ffb42 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/DataImportConstant.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/DataImportConstant.java @@ -82,4 +82,16 @@ public interface DataImportConstant { String SHOP_ORDER_CUSTOM_FIELD_DISPATCHING_STATUS_Y = "Y"; + //不合格数据类型 + String NC_CODE_DATA_TYPE_SIMPLE = "简单"; + String NC_CODE_DATA_TYPE_COMMENT = "输入注释"; + String NC_CODE_DATA_TYPE_COMPONENT = "组件"; + String NC_CODE_DATA_TYPE_INFO = "信息"; + String NC_CODE_DATA_TYPE_MESSAGE = "信息"; + String NC_CODE_DATA_TYPE_NONE = "无"; + + //不合格类别 + String NC_CODE_CATEGORY_FAILURE = "故障"; + String NC_CODE_CATEGORY_DEFECT = "缺陷"; + String NC_CODE_CATEGORY_REPAIR = "修复"; } diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java index 2b10eaa7..3e3efe30 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/IntegrationTypeConstant.java @@ -1,5 +1,12 @@ package com.foreverwin.mesnac.common.constant; +/** + * 外部系统交互接口类型 + * + * + * @author Leon + * @date 2021/7/8 + */ public class IntegrationTypeConstant { public static final String ITEM = "ITEM"; diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/ItemWSClient.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/ItemWSClient.java index 906be323..ffa83558 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/ItemWSClient.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/ItemWSClient.java @@ -9,6 +9,7 @@ import com.sap.me.common.ObjectAliasEnum; import com.sap.me.common.ObjectReference; import com.sap.me.productdefinition.ItemConfigurationServiceInterface; import com.sap.me.productdefinition.ItemFullConfiguration; +import com.sap.me.productdefinition.QuantityRestriction; import java.math.BigDecimal; @@ -20,6 +21,12 @@ import java.math.BigDecimal; */ public class ItemWSClient { + /** + * 查询物料 + * + * @param data + * @return + */ public static ItemFullConfiguration find(JSONObject data) { try { String site = (String) data.get("site"); @@ -29,8 +36,8 @@ public class ItemWSClient { //---------------------------------------------------------------------------------------------------------- ItemConfigurationServiceInterface itemConfigurationService = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site); - ObjectReference request = new ObjectReference(objRef); - ItemFullConfiguration op = itemConfigurationService.readItem(request); + ObjectReference objectReference = new ObjectReference(objRef); + ItemFullConfiguration op = itemConfigurationService.readItem(objectReference); return op; } catch (Exception e) { @@ -39,6 +46,13 @@ public class ItemWSClient { return null; } + /** + * 更新物料 + * + * @param jsonObject + * @param itemFull + * @return + */ public static String update(JSONObject jsonObject, ItemFullConfiguration itemFull) { try { String site = jsonObject.getString("site"); @@ -49,6 +63,11 @@ public class ItemWSClient { //--------------------------------------------------------------------------------------- ItemConfigurationServiceInterface itemConfigurationService = MEServices.create("com.sap.me.productdefinition", "ItemConfigurationService", site); itemFull.setLotSize(new BigDecimal(lotSize)); + if ("1".equals(lotSize)) { + itemFull.setQuantityRestriction(QuantityRestriction.ONLY_1); + } else { + itemFull.setQuantityRestriction(QuantityRestriction.ANY_NUMBER); + } itemConfigurationService.updateItem(itemFull); //自定义字段保存 diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcCodeWSClient.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcCodeWSClient.java index a4522efd..69d50b60 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcCodeWSClient.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcCodeWSClient.java @@ -1,15 +1,16 @@ package com.foreverwin.mesnac.dataimport.client; import com.alibaba.fastjson.JSONObject; +import com.foreverwin.mesnac.common.constant.DataImportConstant; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.modular.core.meext.MEServices; import com.sap.me.common.BasicStatusEnum; +import com.sap.me.common.ObjectAliasEnum; import com.sap.me.common.ObjectReference; import com.sap.me.nonconformance.*; -import javax.xml.datatype.DatatypeConstants; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -83,14 +84,14 @@ public class NcCodeWSClient { //不合格代码类型 NCCategory ncCodeCategory = NCCategory.FAILURE; - switch (category) { - case "故障" : + switch (category.trim()) { + case DataImportConstant.NC_CODE_CATEGORY_FAILURE : ncCodeCategory = NCCategory.FAILURE; break; - case "缺陷" : + case DataImportConstant.NC_CODE_CATEGORY_DEFECT : ncCodeCategory = NCCategory.DEFECT; break; - case "修复" : + case DataImportConstant.NC_CODE_CATEGORY_REPAIR : ncCodeCategory = NCCategory.REPAIR; break; default: break; @@ -98,7 +99,11 @@ public class NcCodeWSClient { ncCodeConfiguration.setNcCategory(ncCodeCategory); //不合格数据类型 - dataType = StringUtil.notBlank(dataType) ? dataType : "SIMPLE"; + if (StringUtil.isBlank(dataType)) { + dataType = "SIMPLE"; + } else if ("SIMPLE".equals(dataType) || DataImportConstant.NC_CODE_DATA_TYPE_SIMPLE.equals(dataType)) { + dataType = "SIMPLE"; + } String ncDataTypeRef = HandleEnum.DATA_TYPE.getHandle(site, "NC", dataType); ncCodeConfiguration.setNcDataTypeRef(ncDataTypeRef); @@ -115,13 +120,13 @@ public class NcCodeWSClient { if (StringUtil.notBlank(secondaryCodes)) { List ncSecondaryCodeList = new ArrayList<>(); - if (!secondaryCodes.contains(":")) { + if (!secondaryCodes.contains(";")) { NcSecondaryCode ncSecondaryCode = new NcSecondaryCode(); String ncCodeRef = HandleEnum.NC_CODE.getHandle(site, secondaryCodes); ncSecondaryCode.setNcCodeRef(ncCodeRef); ncSecondaryCodeList.add(ncSecondaryCode); } else { - String [] secondaryCodeArray = secondaryCodes.split(":"); + String [] secondaryCodeArray = secondaryCodes.split(";"); for (String secondaryCode: secondaryCodeArray) { NcSecondaryCode ncSecondaryCode = new NcSecondaryCode(); String ncCodeRef = HandleEnum.NC_CODE.getHandle(site, secondaryCode); @@ -141,6 +146,9 @@ public class NcCodeWSClient { //------------------------------------------------------------------------------------------------ NcCodeConfigurationServiceInterface ncCodeConfigurationService = MEServices.create("com.sap.me.nonconformance", "NcCodeConfigurationService", site); ncCodeConfigurationService.createNcCode(ncCodeConfiguration); + + //自定义字段保存 + CustomDataWSClient.update(jsonObject, ncCodeConfiguration.getRef(), ObjectAliasEnum.NC_CODE.value()); } catch (Exception e) { return ExceptionUtil.getExceptionMsg(e); } @@ -173,21 +181,33 @@ public class NcCodeWSClient { //不合格代码组 String ncGroup = jsonObject.getString("ncGroup"); - NcGroupMember ncGroupMember = new NcGroupMember(); String ncGroupBo = HandleEnum.NC_GROUP.getHandle(site, ncGroup); - ncGroupMember.setNcGroupRef(ncGroupBo); - ncCodeFullConfiguration.getNcGroupMemberList().add(ncGroupMember); + List ncGroupMemberList = ncCodeFullConfiguration.getNcGroupMemberList(); + if (ncGroupMemberList == null || ncGroupMemberList.size() <= 0) { + NcGroupMember ncGroupMember = new NcGroupMember(); + ncGroupMember.setNcGroupRef(ncGroupBo); + ncCodeFullConfiguration.getNcGroupMemberList().add(ncGroupMember); + } else { + for (NcGroupMember ncGroupMemberModel : ncGroupMemberList) { + if (!ncGroupBo.equals(ncGroupMemberModel.getNcGroupRef())) { + NcGroupMember ncGroupMember = new NcGroupMember(); + ncGroupMember.setNcGroupRef(ncGroupBo); + ncCodeFullConfiguration.getNcGroupMemberList().add(ncGroupMember); + } + } + } + //不合格代码类型 NCCategory ncCodeCategory = NCCategory.FAILURE; - switch (category) { - case "故障" : + switch (category.trim()) { + case DataImportConstant.NC_CODE_CATEGORY_FAILURE : ncCodeCategory = NCCategory.FAILURE; break; - case "缺陷" : + case DataImportConstant.NC_CODE_CATEGORY_DEFECT : ncCodeCategory = NCCategory.DEFECT; break; - case "修复" : + case DataImportConstant.NC_CODE_CATEGORY_REPAIR : ncCodeCategory = NCCategory.REPAIR; break; default: break; @@ -195,7 +215,11 @@ public class NcCodeWSClient { ncCodeFullConfiguration.setNcCategory(ncCodeCategory); //不合格数据类型 - dataType = StringUtil.notBlank(dataType) ? dataType : "SIMPLE"; + if (StringUtil.isBlank(dataType)) { + dataType = "SIMPLE"; + } else if ("SIMPLE".equals(dataType) || DataImportConstant.NC_CODE_DATA_TYPE_SIMPLE.equals(dataType)) { + dataType = "SIMPLE"; + } String ncDataTypeRef = HandleEnum.DATA_TYPE.getHandle(site, "NC", dataType); ncCodeFullConfiguration.setNcDataTypeRef(ncDataTypeRef); @@ -212,13 +236,13 @@ public class NcCodeWSClient { if (StringUtil.notBlank(secondaryCodes)) { List ncSecondaryCodeList = new ArrayList<>(); - if (!secondaryCodes.contains(":")) { + if (!secondaryCodes.contains(";")) { NcSecondaryCode ncSecondaryCode = new NcSecondaryCode(); String ncCodeRef = HandleEnum.NC_CODE.getHandle(site, secondaryCodes); ncSecondaryCode.setNcCodeRef(ncCodeRef); ncSecondaryCodeList.add(ncSecondaryCode); } else { - String [] secondaryCodeArray = secondaryCodes.split(":"); + String [] secondaryCodeArray = secondaryCodes.split(";"); for (String secondaryCode: secondaryCodeArray) { NcSecondaryCode ncSecondaryCode = new NcSecondaryCode(); String ncCodeRef = HandleEnum.NC_CODE.getHandle(site, secondaryCode); @@ -238,6 +262,9 @@ public class NcCodeWSClient { //------------------------------------------------------------------------------------------------ NcCodeConfigurationServiceInterface ncCodeConfigurationService = MEServices.create("com.sap.me.nonconformance", "NcCodeConfigurationService", site); ncCodeConfigurationService.updateNcCode(ncCodeFullConfiguration); + + //自定义字段保存 + CustomDataWSClient.update(jsonObject, ncCodeFullConfiguration.getRef(), ObjectAliasEnum.NC_CODE.value()); } catch (Exception e) { return ExceptionUtil.getExceptionMsg(e); } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java index 3980cf8d..8b389f81 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/client/NcGroupWSClient.java @@ -39,7 +39,6 @@ public class NcGroupWSClient { ObjectReference objectReference = new ObjectReference(ncGroupBo); ncGroupFullConfiguration = ncGroupConfigurationService.readNcGroup(objectReference); } catch (Exception e) { - //------------------- } return ncGroupFullConfiguration; @@ -66,9 +65,10 @@ public class NcGroupWSClient { ncGroupFullConfiguration.setRef(ncGroupBo); ncGroupFullConfiguration.setNcGroup(ncGroup); ncGroupFullConfiguration.setDescription(description); - if ("true".equals(applyAll)) { + if ("true".equals(applyAll) || "是".equals(applyAll)) { ncGroupFullConfiguration.setValidAtAllOperations(true); } else { + ncGroupFullConfiguration.setValidAtAllOperations(false); if (StringUtil.notBlank(applyOperation) && applyOperation.contains(";")) { List list = new ArrayList<>(); String[] operationList = applyOperation.split(";"); @@ -95,10 +95,10 @@ public class NcGroupWSClient { * 不良代码组更新 * * @param jsonObject - * @param ncGroupFull + * @param ncGroupFullConfiguration * @return */ - public static String update(JSONObject jsonObject, NcGroupFullConfiguration ncGroupFull) { + public static String update(JSONObject jsonObject, NcGroupFullConfiguration ncGroupFullConfiguration) { try { String site = jsonObject.getString("site"); String description = jsonObject.getString("description"); @@ -107,10 +107,11 @@ public class NcGroupWSClient { //--------------------------------------------------------------------------------------------------- NcGroupConfigurationServiceInterface ncGroupConfigurationService = MEServices.create("com.sap.me.nonconformance", "NcGroupConfigurationService", site); - ncGroupFull.setDescription(description); - if ("true".equals(applyAll)) { - ncGroupFull.setValidAtAllOperations(true); + ncGroupFullConfiguration.setDescription(description); + if ("true".equals(applyAll) || "是".equals(applyAll)) { + ncGroupFullConfiguration.setValidAtAllOperations(true); } else { + ncGroupFullConfiguration.setValidAtAllOperations(false); if (StringUtil.notBlank(applyOperation) && applyOperation.contains(";")) { List list = new ArrayList<>(); String[] operationList = applyOperation.split(";"); @@ -121,11 +122,11 @@ public class NcGroupWSClient { list.add(ncGroupValidOperation); } - ncGroupFull.setNcGroupValidOperationList(list); + ncGroupFullConfiguration.setNcGroupValidOperationList(list); } } - ncGroupConfigurationService.updateNcGroup(ncGroupFull); + ncGroupConfigurationService.updateNcGroup(ncGroupFullConfiguration); } catch (Exception e) { return ExceptionUtil.getExceptionMsg(e); } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ItemHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ItemHandler.java index 3a7f2806..538e0b92 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ItemHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ItemHandler.java @@ -63,9 +63,11 @@ public class ItemHandler extends BaseHandler { ItemFullConfiguration itemFull = ItemWSClient.find(jsonObject); if (itemFull == null) { resultMessage = "物料主数据不存在"; + } else { + ItemWSClient.update(jsonObject, itemFull); + return 1; } - ItemWSClient.update(jsonObject, itemFull); if (resultMessage != null) { params[2] = resultMessage; failedNumber[0]++; @@ -73,6 +75,7 @@ public class ItemHandler extends BaseHandler { return 0; } } + return 0; } catch (Exception e) { params[2] = e.getMessage(); diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCCodeHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCCodeHandler.java index 57dd77db..42b43b13 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCCodeHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCCodeHandler.java @@ -1,7 +1,6 @@ package com.foreverwin.mesnac.dataimport.handler; import com.alibaba.fastjson.JSONObject; -import com.foreverwin.mesnac.dataimport.client.ItemWSClient; import com.foreverwin.mesnac.dataimport.client.NcCodeWSClient; import com.foreverwin.mesnac.dataimport.client.NcGroupWSClient; import com.foreverwin.mesnac.dataimport.handler.base.BaseHandler; @@ -14,8 +13,6 @@ import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.I18nUtil; import com.sap.me.common.ObjectAliasEnum; import com.sap.me.nonconformance.NcCodeFullConfiguration; -import com.sap.me.nonconformance.NcGroupFullConfiguration; -import com.sap.me.productdefinition.ItemFullConfiguration; import java.io.InputStream; import java.util.Map; @@ -68,16 +65,22 @@ public class NCCodeHandler extends BaseHandler { if (jsonObject.containsKey("ncGroup") && jsonObject.getString("ncGroup").trim().length() > 0) { jsonObject.put("site", site); NcCodeFullConfiguration ncCodeFull = NcCodeWSClient.find(jsonObject); - if (ncCodeFull == null) { - if (AppUtil.canInsert(mode)) { - insert = true; - NcGroupWSClient.create(jsonObject); - }else if(AppUtil.canUpdate(mode)) { - resultMessage = ("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.update.fail", params) + "\n"); + if (ncCodeFull != null) { + if (AppUtil.canUpdate(mode)) { + resultMessage = NcCodeWSClient.update(jsonObject, ncCodeFull); + if (resultMessage == null) { + return 1; + } } } else { - if (AppUtil.canUpdate(mode)) { - NcCodeWSClient.update(jsonObject, ncCodeFull); + if (AppUtil.canInsert(mode)) { + insert = true; + resultMessage = NcCodeWSClient.create(jsonObject); + if (resultMessage == null) { + return 1; + } + } else if(AppUtil.canUpdate(mode)) { + resultMessage = ("更新的不合格代码不存在" + "\n"); } } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCGroupHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCGroupHandler.java index b9a614e9..5ca6ee67 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCGroupHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/NCGroupHandler.java @@ -61,16 +61,21 @@ public class NCGroupHandler extends BaseHandler { if (jsonObject.containsKey("ncGroup") && jsonObject.getString("ncGroup").trim().length() > 0) { jsonObject.put("site", site); NcGroupFullConfiguration ncGroupFull = NcGroupWSClient.find(jsonObject); - if (ncGroupFull == null) { - if (AppUtil.canInsert(mode)) { - insert = true; - NcGroupWSClient.create(jsonObject); - }else if(AppUtil.canUpdate(mode)) { - resultMessage = ("第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.update.fail", params) + "\n"); + if (ncGroupFull != null) { + if (AppUtil.canUpdate(mode)) { + resultMessage = NcGroupWSClient.update(jsonObject, ncGroupFull); + if (resultMessage == null) { + return 1; + } } } else { - if (AppUtil.canUpdate(mode)) { - NcGroupWSClient.update(jsonObject, ncGroupFull); + if (AppUtil.canInsert(mode)) { + resultMessage = NcGroupWSClient.create(jsonObject); + if (resultMessage == null) { + return 1; + } + } else if(AppUtil.canUpdate(mode)) { + resultMessage = ("更新的不合格组不存在" + "\n"); } } diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/OperationHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/OperationHandler.java index e25fe877..b8eb2ff8 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/OperationHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/OperationHandler.java @@ -80,6 +80,7 @@ public class OperationHandler extends BaseHandler { resultMessage ="第" + index + "行:" + I18nUtil.getI18nText("MaterData.import.upDateObjectNotExist") + "\n"; } } + if (resultMessage != null) { params[2] = resultMessage; failedNumber[0]++; diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ResourceTypeHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ResourceTypeHandler.java index 03b2285c..0043dcd1 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ResourceTypeHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/ResourceTypeHandler.java @@ -62,7 +62,10 @@ public class ResourceTypeHandler extends BaseHandler { if (collection.size() > 0) { resultMessage = "资源类型主数据已经存在"; } else { - ResourceTypeWSClient.insert(jsonObject); + resultMessage = ResourceTypeWSClient.insert(jsonObject); + if (resultMessage == null) { + return 1; + } } if (resultMessage != null) { diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/WorkCenterHandler.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/WorkCenterHandler.java index 8ce2c8a1..59e01be0 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/WorkCenterHandler.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/handler/WorkCenterHandler.java @@ -60,8 +60,9 @@ public class WorkCenterHandler extends BaseHandler { try { if (jsonObject.containsKey("workCenter") && jsonObject.getString("workCenter").trim().length() > 0) { jsonObject.put("site", site); - WorkCenterFullConfiguration result = WorkCenterWSClient.find(jsonObject); + String resultMessage = null; + WorkCenterFullConfiguration result = WorkCenterWSClient.find(jsonObject); if (result != null && result.getWorkCenter() != null && result.getWorkCenter().length() > 0) { if (AppUtil.canUpdate(mode)) { resultMessage = WorkCenterWSClient.update(jsonObject, result); @@ -80,6 +81,7 @@ public class WorkCenterHandler extends BaseHandler { resultMessage = "第" +index+ "行:" + I18nUtil.getI18nText("MaterData.import.upDateObjectNotExist") + "\n"; } } + if (resultMessage != null) { params[2] = resultMessage; failedNumber[0]++; @@ -91,6 +93,7 @@ public class WorkCenterHandler extends BaseHandler { } } return 0; + } catch (Exception e) { params[2] = e.getMessage(); failedNumber[0]++; diff --git a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java index 23fa30ad..b50c9678 100644 --- a/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java +++ b/dataimport/src/main/java/com/foreverwin/mesnac/dataimport/service/MasterObjectDefine.java @@ -22,8 +22,6 @@ public class MasterObjectDefine { cvsHeadsMapping.put("seqNum","序号"); cvsHeadsMapping.put("item","物料编码"); cvsHeadsMapping.put("lotSize","批次大小"); - cvsHeadsMapping.put("perMeter","自定义-PER_METER"); - cvsHeadsMapping.put("perSquareMeter","自定义-PER_SQUARE_METER"); break; diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java index 5eba80f2..d0d7b17a 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/CallItemController.java @@ -1,17 +1,18 @@ package com.foreverwin.mesnac.dispatch.controller; +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.dispatch.dto.IssueItemDto; import com.foreverwin.modular.core.exception.BusinessException; 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 org.springframework.web.bind.annotation.RequestMapping; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.foreverwin.mesnac.dispatch.service.CallItemService; import com.foreverwin.mesnac.dispatch.model.CallItem; + +import java.time.LocalDateTime; import java.util.List; /** @@ -28,7 +29,7 @@ public class CallItemController { /** - * 查询所有数据 + * 查询叫料数据 * * @return */ @@ -47,6 +48,45 @@ public class CallItemController { return R.ok(result); } + /** + * 查询叫料明细数据 + * + * @return + */ + @ResponseBody + @PostMapping("/findCallItemDetailList") + public R findCallItemDetailList(@RequestBody CallItem callItem){ + List result; + try { + callItem.setSite(CommonMethods.getSite()); + result = callItemService.findCallItemDetailList(callItem); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + + return R.ok(result); + } + + /** + * 查询叫料明细数据 + * + * @return + */ + @ResponseBody + @PostMapping("/findCallItemDetailListByDispatchBo") + public R findCallItemDetailListByDispatchBo(@RequestBody List dispatchBoList){ + List result; + try { + String site = CommonMethods.getSite(); + result = callItemService.findCallItemDetailListByDispatchBo(site, dispatchBoList); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + + return R.ok(result); + } @ResponseBody @PostMapping("/callItem") @@ -82,4 +122,69 @@ public class CallItemController { return R.ok("确认到料操作成功"); } + + @ResponseBody + @PostMapping("/cancelCallItem") + public R cancelCallItem(@RequestBody List callItemNoList) { + try { + String site = CommonMethods.getSite(); + String user = CommonMethods.getUser(); + if (callItemNoList == null || callItemNoList.size() <= 0) { + throw BusinessException.build("请至少选择一笔记录"); + } + callItemService.cancelCallItem(site, user, callItemNoList); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + return R.ok("取消叫料成功"); + } + + @ResponseBody + @PostMapping("/refreshRequiredTime") + public R refreshRequiredTime(@RequestBody List callItemNoList) { + try { + String site = CommonMethods.getSite(); + String user = CommonMethods.getUser(); + if (callItemNoList == null || callItemNoList.size() <= 0) { + throw BusinessException.build("请至少选择一笔记录"); + } + callItemService.refreshRequiredTime(site, user, callItemNoList); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + return R.ok("刷新需求时间成功"); + } + + + @ResponseBody + @GetMapping("/findIssueItemList") + public R findIssueItemList(String workCenter, String resource, String shopOrder, String dispatchNo, String requiredFromDate, String requiredToDate, Boolean matchResource) { + List result; + try { + String site = CommonMethods.getSite(); + + //参数拼装 + IssueItemDto issueItemDto = new IssueItemDto(); + issueItemDto.setSite(site); + issueItemDto.setResource(resource); + issueItemDto.setWorkCenter(workCenter); + issueItemDto.setShopOrder(shopOrder); + issueItemDto.setDispatchNo(dispatchNo); + issueItemDto.setMatchResource(matchResource); + if (StringUtil.notBlank(requiredFromDate)) { + issueItemDto.setRequiredFromDT(LocalDateTime.parse(requiredFromDate)); + } + if (StringUtil.notBlank(requiredToDate)) { + issueItemDto.setRequiredToDT(LocalDateTime.parse(requiredToDate)); + } + + result = callItemService.findIssueItemList(issueItemDto); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + return R.ok(result); + } } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/dto/IssueItemDto.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/dto/IssueItemDto.java new file mode 100644 index 00000000..b6b8c430 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/dto/IssueItemDto.java @@ -0,0 +1,80 @@ +package com.foreverwin.mesnac.dispatch.dto; + +import java.io.Serializable; +import java.time.LocalDateTime; + +public class IssueItemDto implements Serializable { + + private String site; + private String resource; + private String workCenter; + private String shopOrder; + private String dispatchNo; + private Boolean matchResource; + private LocalDateTime requiredFromDT; + private LocalDateTime requiredToDT; + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public String getWorkCenter() { + return workCenter; + } + + public void setWorkCenter(String workCenter) { + this.workCenter = workCenter; + } + + public String getShopOrder() { + return shopOrder; + } + + public void setShopOrder(String shopOrder) { + this.shopOrder = shopOrder; + } + + public String getDispatchNo() { + return dispatchNo; + } + + public void setDispatchNo(String dispatchNo) { + this.dispatchNo = dispatchNo; + } + + public Boolean getMatchResource() { + return matchResource; + } + + public void setMatchResource(Boolean matchResource) { + this.matchResource = matchResource; + } + + public LocalDateTime getRequiredFromDT() { + return requiredFromDT; + } + + public void setRequiredFromDT(LocalDateTime requiredFromDT) { + this.requiredFromDT = requiredFromDT; + } + + public LocalDateTime getRequiredToDT() { + return requiredToDT; + } + + public void setRequiredToDT(LocalDateTime requiredToDT) { + this.requiredToDT = requiredToDT; + } +} diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java index 25b11ce3..9e8930d2 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/CallItemMapper.java @@ -1,6 +1,7 @@ package com.foreverwin.mesnac.dispatch.mapper; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; +import com.foreverwin.mesnac.dispatch.dto.IssueItemDto; import com.foreverwin.mesnac.dispatch.model.CallItem; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.foreverwin.mesnac.dispatch.model.SfcDispatch; @@ -51,6 +52,33 @@ public interface CallItemMapper extends BaseMapper { */ List findCallItemList(CallItem callItem); + /** + * 查询叫料明细 + * + * @param callItem + * @return + */ + List findCallItemDetailList(CallItem callItem); + + /** + * 查询叫料明细 + * + * @param site + * @param list + * @return + */ + List findCallItemDetailListByDispatchBo(@Param("site") String site, @Param("list") List list); + + /** + * 修改叫料数据状态 + * + * @param status + * @param user + * @param dateTime + * @param list + */ + void updateCallItemStatusByDispatchBo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); + /** * 修改叫料数据状态 * @@ -59,5 +87,22 @@ public interface CallItemMapper extends BaseMapper { * @param dateTime * @param list */ - void updateCallItemStatus(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); + void updateCallItemStatusByCallItemNo(@Param("status") String status, @Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); + + /** + * 刷新叫料时间 + * + * @param user + * @param dateTime + * @param list + */ + void refreshRequiredTime(@Param("user") String user, @Param("dateTime") LocalDateTime dateTime, @Param("list") List list); + + + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //车间发料查询 + List finsIssueItemListToResource(IssueItemDto issueItemDto); + List finsIssueItemListNoResource(IssueItemDto issueItemDto); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/CallItem.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/CallItem.java index 0507d2ea..0243d9f9 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/CallItem.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/CallItem.java @@ -136,12 +136,18 @@ public class CallItem extends Model { @TableField(exist = false) private String item; @TableField(exist = false) + private String component; + @TableField(exist = false) private String itemDescription; @TableField(exist = false) private String materialType; @TableField(exist = false) private String dispatchStatus; @TableField(exist = false) + private String employee; + @TableField(exist = false) + private String sourceResource; + @TableField(exist = false) private String workOrder; @TableField(exist = false) private String workCenter; @@ -160,7 +166,6 @@ public class CallItem extends Model { @TableField(exist = false) private String remark; - public String getHandle() { return handle; } @@ -177,6 +182,14 @@ public class CallItem extends Model { this.site = site; } + public String getSfcDispatchBo() { + return sfcDispatchBo; + } + + public void setSfcDispatchBo(String sfcDispatchBo) { + this.sfcDispatchBo = sfcDispatchBo; + } + public String getCallItemNo() { return callItemNo; } @@ -201,14 +214,6 @@ public class CallItem extends Model { this.sfc = sfc; } - public String getSfcDispatchBo() { - return sfcDispatchBo; - } - - public void setSfcDispatchBo(String sfcDispatchBo) { - this.sfcDispatchBo = sfcDispatchBo; - } - public String getOperation() { return operation; } @@ -337,6 +342,14 @@ public class CallItem extends Model { this.item = item; } + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } + public String getItemDescription() { return itemDescription; } @@ -361,6 +374,22 @@ public class CallItem extends Model { this.dispatchStatus = dispatchStatus; } + public String getEmployee() { + return employee; + } + + public void setEmployee(String employee) { + this.employee = employee; + } + + public String getSourceResource() { + return sourceResource; + } + + public void setSourceResource(String sourceResource) { + this.sourceResource = sourceResource; + } + public String getWorkOrder() { return workOrder; } diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java index cada9caa..b1ea31dd 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/CallItemService.java @@ -1,11 +1,9 @@ package com.foreverwin.mesnac.dispatch.service; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; +import com.foreverwin.mesnac.dispatch.dto.IssueItemDto; import com.foreverwin.mesnac.dispatch.model.CallItem; import com.baomidou.mybatisplus.extension.service.IService; -import com.foreverwin.modular.core.util.FrontPage; - import java.util.List; /** @@ -19,29 +17,38 @@ import java.util.List; public interface CallItemService extends IService { /** - * 分页查询 - * @param frontPage + * 生产叫料查询 + * + * @param callItem + */ + List findCallItemList(CallItem callItem); + + /** + * 叫料明细查询 + * + * @param callItem * @return */ - IPage selectPage(FrontPage frontPage, CallItem callItem); + List findCallItemDetailList(CallItem callItem); - List selectList(CallItem callItem); /** - * 保存叫料数据 + * 叫料明细查询 * * @param site - * @param user - * @param sfcDispatchList + * @param dispatchBoList + * @return */ - void saveCallItem(String site, String user, List sfcDispatchList); + List findCallItemDetailListByDispatchBo(String site, List dispatchBoList); /** - * 生产叫料查询 + * 保存叫料数据 * - * @param callItem + * @param site + * @param user + * @param sfcDispatchList */ - List findCallItemList(CallItem callItem); + void saveCallItem(String site, String user, List sfcDispatchList); /** * 叫料 @@ -61,4 +68,32 @@ public interface CallItemService extends IService { * @param callItemList */ void confirmReceive(String site, String user, List callItemList); + + /** + * 取消叫料 + * + * @param site + * @param user + * @param callItemNoList + */ + void cancelCallItem(String site, String user, List callItemNoList); + + /** + * 刷新需求时间 + * + * @param site + * @param user + * @param callItemNoList + */ + void refreshRequiredTime(String site, String user, List callItemNoList); + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * 查询发料组件清单 + * + * @param issueItemDto + * @return + */ + List findIssueItemList(IssueItemDto issueItemDto); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java index 10df2048..f713cb1c 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/CallItemServiceImpl.java @@ -4,6 +4,7 @@ import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.dispatch.dto.IssueItemDto; import com.foreverwin.modular.core.exception.BusinessException; import com.foreverwin.modular.core.util.FrontPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -21,6 +22,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** *

@@ -38,20 +40,6 @@ public class CallItemServiceImpl extends ServiceImpl i @Autowired private CallItemMapper callItemMapper; - @Override - public IPage selectPage(FrontPage frontPage, CallItem callItem) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(callItem); - return super.page(frontPage.getPagePlus(), queryWrapper); - } - - @Override - public List selectList(CallItem callItem) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(callItem); - return super.list(queryWrapper); - } - @Override public void saveCallItem(String site, String user, List sfcDispatchList) { if (sfcDispatchList == null || sfcDispatchList.size() <= 0) { @@ -129,10 +117,19 @@ public class CallItemServiceImpl extends ServiceImpl i @Override public List findCallItemList(CallItem callItem) { - return callItemMapper.findCallItemList(callItem); } + @Override + public List findCallItemDetailList(CallItem callItem) { + return callItemMapper.findCallItemDetailList(callItem); + } + + @Override + public List findCallItemDetailListByDispatchBo(String site, List dispatchBoList) { + return callItemMapper.findCallItemDetailListByDispatchBo(site, dispatchBoList); + } + @Override public void callItem(String site, String user, List callItemList) { if (callItemList == null || callItemList.size() <= 0) { @@ -140,7 +137,7 @@ public class CallItemServiceImpl extends ServiceImpl i } LocalDateTime dateTime = LocalDateTime.now(); - callItemMapper.updateCallItemStatus(Constants.CALL_ITEM_STATUS_CALLED, user, dateTime, callItemList); + callItemMapper.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_CALLED, user, dateTime, callItemList); } @Override @@ -166,6 +163,38 @@ public class CallItemServiceImpl extends ServiceImpl i } LocalDateTime dateTime = LocalDateTime.now(); - callItemMapper.updateCallItemStatus(Constants.CALL_ITEM_STATUS_ISSUED, user, dateTime, callItemList); + callItemMapper.updateCallItemStatusByDispatchBo(Constants.CALL_ITEM_STATUS_ISSUED, user, dateTime, callItemList); + } + + @Override + public void cancelCallItem(String site, String user, List callItemNoList) { + if (callItemNoList == null || callItemNoList.size() <= 0) { + return; + } + + LocalDateTime dateTime = LocalDateTime.now(); + callItemMapper.updateCallItemStatusByCallItemNo(Constants.CALL_ITEM_STATUS_CANCELED, user, dateTime, callItemNoList); + } + + @Override + public void refreshRequiredTime(String site, String user, List callItemNoList) { + if (callItemNoList == null || callItemNoList.size() <= 0) { + return; + } + callItemNoList.stream().distinct().collect(Collectors.toList()); + + LocalDateTime dateTime = LocalDateTime.now(); + callItemMapper.refreshRequiredTime(user, dateTime, callItemNoList); + } + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + @Override + public List findIssueItemList(IssueItemDto issueItemDto) { + if (issueItemDto.getMatchResource()) { + return callItemMapper.finsIssueItemListToResource(issueItemDto); + } else { + return callItemMapper.finsIssueItemListNoResource(issueItemDto); + } } } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index 747c04d1..47330a4f 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -5,6 +5,7 @@ import com.foreverwin.mesnac.common.constant.Constants; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.enums.DispatchStatusEnum; import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.service.ProdReadyTaskService; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.util.ExcelUtils; import com.foreverwin.mesnac.common.util.StringUtil; @@ -54,6 +55,8 @@ public class SfcDispatchServiceImpl extends ServiceImpl findSfcDispatch(String site, String sfc, String operation, String stepId) { @@ -75,6 +78,9 @@ public class SfcDispatchServiceImpl extends ServiceImpl 0) { this.updateBatchById(list); } + + //取消产前准备任务 + prodReadyTaskService.createTask(sfcDispatchList); } @Override diff --git a/dispatch/src/main/resources/mapper/CallItemMapper.xml b/dispatch/src/main/resources/mapper/CallItemMapper.xml index 6a716911..493d1dc9 100644 --- a/dispatch/src/main/resources/mapper/CallItemMapper.xml +++ b/dispatch/src/main/resources/mapper/CallItemMapper.xml @@ -28,8 +28,11 @@ + + + @@ -621,14 +624,14 @@ - + + + + + UPDATE Z_CALL_ITEM SET STATUS = #{status}, UPDATE_USER = #{user}, UPDATED_DATE_TIME = #{dateTime} WHERE STATUS != '804' AND SFC_DISPATCH_BO IN #{item.sfcDispatchBo} + + + UPDATE Z_CALL_ITEM SET STATUS = #{status}, UPDATE_USER = #{user}, UPDATED_DATE_TIME = #{dateTime} + WHERE STATUS != '804' AND CALL_ITEM_NO IN + + #{item} + + + + + UPDATE Z_CALL_ITEM SET UPDATE_USER = #{user}, UPDATED_DATE_TIME = #{dateTime}, REQUIRED_DATE_TIME = ( + SELECT ZSD.PLANNED_START_DATE + FROM Z_SFC_DISPATCH ZSD + WHERE Z_CALL_ITEM.SFC_DISPATCH_BO = ZSD.HANDLE + ) + WHERE Z_CALL_ITEM.CALL_ITEM_NO IN + + #{item} + + + + + + diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchDto.java b/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchDto.java index 36d4cf64..40f65b36 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchDto.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchDto.java @@ -7,27 +7,35 @@ import javax.xml.bind.annotation.XmlType; @XmlAccessorType( XmlAccessType.FIELD ) @XmlType(name = "ItemBatchDto", propOrder = { + "FACTORY", "RSNUM", "ITEM", "SPEC", "TEXTURE", - "BATCH", - "SUPPLIER" + "BATCH" }) public class ItemBatchDto { + @XmlElement(name = "FACTORY") + private String FACTORY; @XmlElement(name = "RSNUM") private String RSNUM; - @XmlElement(name = "ITEM", required = true) + @XmlElement(name = "ITEM") private String ITEM; @XmlElement(name = "SPEC") private String SPEC; @XmlElement(name = "TEXTURE") private String TEXTURE; - @XmlElement(name = "BATCH", required = true) + @XmlElement(name = "BATCH") private String BATCH; - @XmlElement(name = "SUPPLIER", required = true) - private String SUPPLIER; + + public String getFACTORY() { + return FACTORY; + } + + public void setFACTORY(String FACTORY) { + this.FACTORY = FACTORY; + } public String getRSNUM() { return RSNUM; @@ -69,23 +77,15 @@ public class ItemBatchDto { this.BATCH = BATCH; } - public String getSUPPLIER() { - return SUPPLIER; - } - - public void setSUPPLIER(String SUPPLIER) { - this.SUPPLIER = SUPPLIER; - } - @Override public String toString() { return "ItemBatchDto{" + - "RSNUM='" + RSNUM + '\'' + + "FACTORY='" + FACTORY + '\'' + + ", RSNUM='" + RSNUM + '\'' + ", ITEM='" + ITEM + '\'' + ", SPEC='" + SPEC + '\'' + ", TEXTURE='" + TEXTURE + '\'' + ", BATCH='" + BATCH + '\'' + - ", SUPPLIER='" + SUPPLIER + '\'' + '}'; } } diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchReceiveRequest.java b/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchReceiveRequest.java index 0a7b0dc3..8813a62f 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchReceiveRequest.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/dto/ItemBatchReceiveRequest.java @@ -17,23 +17,23 @@ import java.util.List; "TRANID", "DATE_TIME", "SITE", - "FACTORY", + "SUPPLIER", "PURCHASE_ORDER", "PURCHASE_ORDER_LIST" }) public class ItemBatchReceiveRequest { - @XmlElement(name = "TRANID", required = true) + @XmlElement(name = "TRANID") private String TRANID; - @XmlElement(name = "DATE_TIME", required = true) + @XmlElement(name = "DATE_TIME") private String DATE_TIME; - @XmlElement(name = "SITE", required = true) + @XmlElement(name = "SITE") private String SITE; - @XmlElement(name = "FACTORY") - private String FACTORY; + @XmlElement(name = "SUPPLIER") + private String SUPPLIER; @XmlElement(name = "PURCHASE_ORDER") private String PURCHASE_ORDER; - @XmlElement(name = "PURCHASE_ORDER_LIST", required = true) + @XmlElement(name = "PURCHASE_ORDER_LIST") private List PURCHASE_ORDER_LIST; public String getTRANID() { @@ -60,12 +60,12 @@ public class ItemBatchReceiveRequest { this.SITE = SITE; } - public String getFACTORY() { - return FACTORY; + public String getSUPPLIER() { + return SUPPLIER; } - public void setFACTORY(String FACTORY) { - this.FACTORY = FACTORY; + public void setSUPPLIER(String SUPPLIER) { + this.SUPPLIER = SUPPLIER; } public String getPURCHASE_ORDER() { @@ -90,7 +90,7 @@ public class ItemBatchReceiveRequest { "TRANID='" + TRANID + '\'' + ", DATE_TIME='" + DATE_TIME + '\'' + ", SITE='" + SITE + '\'' + - ", FACTORY='" + FACTORY + '\'' + + ", SUPPLIER='" + SUPPLIER + '\'' + ", PURCHASE_ORDER='" + PURCHASE_ORDER + '\'' + ", PURCHASE_ORDER_LIST=" + PURCHASE_ORDER_LIST + '}'; diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java index 20448446..cdd98084 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java @@ -25,6 +25,7 @@ import com.sap.me.production.ChangeProductionServiceInterface; import com.sap.me.production.OperationPlacementTypeEnum; import com.visiprise.globalization.DateGlobalizationServiceInterface; import com.visiprise.globalization.GlobalizationService; +import com.visiprise.globalization.util.DateTimeInterface; import com.visiprise.model.BOMType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; @@ -180,11 +181,9 @@ public class InterfaceServiceImpl implements InterfaceService { } bomComponentDtoList.sort((a,b) -> Float.compare(a.getSEQ().floatValue(), b.getSEQ().floatValue())); - Boolean isChange = false; //查询工艺路线是否存在, 不存在版本默认为1.0,存在最大版本+1最为当前版本 Bom bomModel = bomService.getMaxRevisionBom(site, bom); if (bomModel != null) { - isChange = true; Float currentRevision = new Float(bomModel.getRevision()); revision = currentRevision + 1; bomBo = HandleEnum.BOM.getHandle(site, bom, revision.toString(), BOMType._H); @@ -241,30 +240,6 @@ public class InterfaceServiceImpl implements InterfaceService { bomConfiguration.setBomComponentList(componentConfigurationList); //物料清单保存 bomConfigurationService.createBOM(bomConfiguration); - - //非BOM变更 - if (!isChange) return; - - //查询工单是否已下达,已下达则表示需要做变更 - String shopOrderBo = HandleEnum.SHOP_ORDER.getHandle(site, shopOrder); - List sfcList = sfcService.getSfcListByShopOrderBo(shopOrderBo); - if (sfcList == null || sfcList.size() <= 0) { - return; - } - - //如果工单已经开始生产,做更改生产操作 - ChangeProductionRequest changeProductionRequest = new ChangeProductionRequest(); - - //变更内容 - ChangeProductionContext changeProductionContext = new ChangeProductionContext(); - changeProductionContext.setNewBom(bom); - changeProductionContext.setNewBomRevision(revision.toString()); - changeProductionRequest.setChangeProductionContextType(changeProductionContext); - - //变更注释 - changeProductionRequest.setCommentsRequired(true); - changeProductionRequest.setComments("BOM变更,更改生产"); - changeProductionService.changeProduction(changeProductionRequest); } @Override @@ -293,11 +268,9 @@ public class InterfaceServiceImpl implements InterfaceService { String routerType = RouterType.SHOPORDER_SPECIFIC.value(); String routerBo = HandleEnum.ROUTER.getHandle(site, router, routerType, revision.toString()); - Boolean isChange = false; //查询工艺路线是否存在, 不存在版本默认为1.0,存在最大版本+1最为当前版本 Router routerModel = routerService.getMaxRevisionRouter(site, router); if (routerModel != null) { - isChange = true; Float currentRevision = new Float(routerModel.getRevision()); revision = currentRevision + 1; routerBo = HandleEnum.ROUTER.getHandle(site, router, routerType, revision.toString()); @@ -410,33 +383,6 @@ public class InterfaceServiceImpl implements InterfaceService { if (customFieldsList != null && customFieldsList.size() > 0) { customFieldsService.saveOrUpdateCustomFields(customFieldsList); } - - //非工艺路线变更 - if (!isChange) return; - - //查询工单是否已下达,已下达则表示需要做变更 - String shopOrderBo = HandleEnum.SHOP_ORDER.getHandle(site, shopOrder); - List sfcList = sfcService.getSfcListByShopOrderBo(shopOrderBo); - if (sfcList == null || sfcList.size() <= 0) { - return; - } - - //如果工单已经开始生产,做更改生产操作 - ChangeProductionRequest changeProductionRequest = new ChangeProductionRequest(); - - //变更内容 - ChangeProductionContext changeProductionContext = new ChangeProductionContext(); - changeProductionContext.setNewRouter(router); - changeProductionContext.setNewRouterRevision(revision.toString()); - changeProductionRequest.setChangeProductionContextType(changeProductionContext); - - //选择车间作业控制的工艺路线操作位置 - changeProductionRequest.setOperationPlacementType(OperationPlacementTypeEnum.CURRENT_OPERATION); - - //变更注释 - changeProductionRequest.setCommentsRequired(true); - changeProductionRequest.setComments("工艺路线变更,更改生产"); - changeProductionService.changeProduction(changeProductionRequest); } @Override @@ -534,6 +480,9 @@ public class InterfaceServiceImpl implements InterfaceService { if (StringUtil.notBlank(completeDateTime)) { shopOrderFull.setPlannedCompletionDate(dateService.createDateTime(simpleDateFormat.parse(completeDateTime).getTime())); } + + //工单最后修改时间 + shopOrderFull.setModifiedDateTime(dateService.createDateTime(shopOrderModel.getModifiedDateTime().getTime())); shopOrderMeService.updateShopOrder(shopOrderFull); } @@ -604,12 +553,12 @@ public class InterfaceServiceImpl implements InterfaceService { @Override public void saveItemBatch(String site, ItemBatchReceiveRequest itemBatchReceiveRequest) { - String factory = itemBatchReceiveRequest.getFACTORY(); List itemBatchDtoList = itemBatchReceiveRequest.getPURCHASE_ORDER_LIST(); if (itemBatchDtoList == null || itemBatchDtoList.size() <= 0) { throw BusinessException.build("接口参数【PURCHASE_ORDER_LIST】不能为空"); } + String supplier = itemBatchReceiveRequest.getSUPPLIER(); LocalDateTime now = LocalDateTime.now(); //循环处理 物料批次 for (int i = 0; i < itemBatchDtoList.size(); i++) { @@ -624,7 +573,7 @@ public class InterfaceServiceImpl implements InterfaceService { if (StringUtil.isBlank(item)) { throw BusinessException.build("批次号不能为空"); } - String supplier = itemBatchDto.getSUPPLIER(); + String factory = itemBatchDto.getFACTORY(); //查询物料和批次是否已经存在记录 ItemBatch queryBatch = new ItemBatch(); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/ShopOrder.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/ShopOrder.java index d2e8f43d..7b5fe9b1 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/ShopOrder.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/ShopOrder.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableField; import java.io.Serializable; +import java.util.Date; + import com.baomidou.mybatisplus.annotation.IdType; /** @@ -77,7 +79,7 @@ public class ShopOrder extends Model { @TableField("CREATED_DATE_TIME") private LocalDateTime createdDateTime; @TableField("MODIFIED_DATE_TIME") - private LocalDateTime modifiedDateTime; + private Date modifiedDateTime; @TableField("CUSTOMER") private String customer; @TableField("CUSTOMER_ORDER") @@ -344,11 +346,11 @@ public class ShopOrder extends Model { this.createdDateTime = createdDateTime; } - public LocalDateTime getModifiedDateTime() { + public Date getModifiedDateTime() { return modifiedDateTime; } - public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + public void setModifiedDateTime(Date modifiedDateTime) { this.modifiedDateTime = modifiedDateTime; } From 82f7d0d36c4985cc8725b85c665b638d9191a2b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Sat, 10 Jul 2021 08:39:25 +0800 Subject: [PATCH 2/9] =?UTF-8?q?7=E6=9C=889=E6=97=A5=EF=BC=8C=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=BC=82=E5=B8=B8=E5=93=8D=E5=BA=94=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=EF=BC=8C=E5=92=8C=E5=BC=82=E5=B8=B8=E6=8F=90=E6=8A=A5=E3=80=81?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9Bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbnormalBillController.java | 27 +++++++- .../anomaly/dto/AbnormalBillDisposeDto.java | 24 +++++++ .../mesnac/anomaly/dto/AbnormalBillDto.java | 66 ++++++++++++++++++- .../mapper/AbnormalBillDisposeMapper.java | 9 +++ .../anomaly/mapper/AbnormalBillMapper.java | 8 +++ .../anomaly/service/AbnormalBillService.java | 7 +- .../service/impl/AbnormalBillServiceImpl.java | 59 +++++++++++------ .../mapper/AbnormalBillDisposeMapper.xml | 12 +++- .../resources/mapper/AbnormalBillMapper.xml | 36 +++++++++- .../dispatch/mapper/SfcDispatchMapper.java | 5 +- .../service/impl/SfcDispatchServiceImpl.java | 24 ++++++- .../resources/mapper/SfcDispatchMapper.xml | 19 ++++++ .../mesnac/meapi/dto/ShopOrderDto.java | 13 ++++ .../main/resources/mapper/ShopOrderMapper.xml | 4 +- 14 files changed, 280 insertions(+), 33 deletions(-) diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index a222710d..29fd3b44 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -6,6 +6,8 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; +import com.foreverwin.mesnac.common.dto.SfcDispatchDto; +import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.modular.core.util.FrontPage; import com.foreverwin.modular.core.util.R; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +27,9 @@ public class AbnormalBillController { @Autowired private AbnormalBillService abnormalBillService; + @Autowired + private SfcDispatchCommonService sfcDispatchCommonService; + /** * 根据id查询 @@ -207,8 +212,8 @@ public class AbnormalBillController { * @return */ @GetMapping("/cancelBrowse") - public R cancelBrowse(String handle, String cancelBrowse){ - abnormalBillService.cancelBrowse(handle,cancelBrowse); + public R cancelBrowse(String handle, String cancelBrowse,String code){ + abnormalBillService.cancelBrowse(handle,cancelBrowse,code); return R.ok(); } @@ -217,11 +222,24 @@ public class AbnormalBillController { return R.ok(abnormalBillService.backLog(abnormalBillDto)); } + /** + * 质量异常响应检索 + * @param abnormalBill + * @return + */ @GetMapping("/findAllByAbnormalNo") public R findAllByAbnormalNo(AbnormalBill abnormalBill){ return R.ok(abnormalBillService.findAllByAbnormalNo(abnormalBill)); } + /** + * 设备异常响应检索 + */ + @GetMapping("/findAllByAbnormalNoDevice") + public R findAllByAbnormalNoDevice(AbnormalBill abnormalBill){ + return R.ok(abnormalBillService.findAllByAbnormalNoDevice(abnormalBill)); + } + /** * 响应处理 * @param abnormalBill @@ -268,4 +286,9 @@ public class AbnormalBillController { abnormalBillService.anomalyShutDown(abnormalBill,abnormalBillDispose); return R.ok(); } + + @GetMapping("/findResrceBySfc") + public R findResrceBySfc(SfcDispatchDto sfcDispatch){ + return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch)); + } } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java index a6cc450e..7cf0fc25 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDisposeDto.java @@ -144,6 +144,16 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose { */ private String router; + /** + * 设备描述 + */ + private String resrceDescription; + + /** + * 上报人员 + */ + private String fullName; + public String getAbnormalNo() { return abnormalNo; } @@ -360,5 +370,19 @@ public class AbnormalBillDisposeDto extends AbnormalBillDispose { this.router = router; } + public String getResrceDescription() { + return resrceDescription; + } + + public void setResrceDescription(String resrceDescription) { + this.resrceDescription = resrceDescription; + } + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDto.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDto.java index 2c4062fd..4fbfe94b 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDto.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/dto/AbnormalBillDto.java @@ -23,12 +23,24 @@ public class AbnormalBillDto extends AbnormalBill { /** * 开始时间 */ - LocalDateTime startDateTime; + private LocalDateTime startDateTime; /** * 结束时间 */ - LocalDateTime endDateTime; + private LocalDateTime endDateTime; + + private String workCenterDescription; + + private String resrceDescription; + + private String reportUser; + + private String abnormalMethod; + + private String confirmUser; + + private String resolveRemark; public String getSeq() { return seq; @@ -61,4 +73,54 @@ public class AbnormalBillDto extends AbnormalBill { public void setEndDateTime(LocalDateTime endDateTime) { this.endDateTime = endDateTime; } + + public String getWorkCenterDescription() { + return workCenterDescription; + } + + public void setWorkCenterDescription(String workCenterDescription) { + this.workCenterDescription = workCenterDescription; + } + + public String getResrceDescription() { + return resrceDescription; + } + + public void setResrceDescription(String resrceDescription) { + this.resrceDescription = resrceDescription; + } + + + + public String getAbnormalMethod() { + return abnormalMethod; + } + + public void setAbnormalMethod(String abnormalMethod) { + this.abnormalMethod = abnormalMethod; + } + + public String getConfirmUser() { + return confirmUser; + } + + public void setConfirmUser(String confirmUser) { + this.confirmUser = confirmUser; + } + + public String getResolveRemark() { + return resolveRemark; + } + + public void setResolveRemark(String resolveRemark) { + this.resolveRemark = resolveRemark; + } + + public String getReportUser() { + return reportUser; + } + + public void setReportUser(String reportUser) { + this.reportUser = reportUser; + } } diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java index a3873c07..9ba80afa 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillDisposeMapper.java @@ -2,6 +2,7 @@ package com.foreverwin.mesnac.anomaly.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto; +import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; import org.apache.ibatis.annotations.Param; @@ -18,7 +19,15 @@ import org.springframework.stereotype.Repository; @Repository public interface AbnormalBillDisposeMapper extends BaseMapper { + /** + * 质量异常检索 + * @param abnormalBill + * @param language + * @return + */ AbnormalBillDisposeDto findAllByAbnormalNo(@Param("abnormalBill") AbnormalBill abnormalBill, @Param("language")String language); + + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java index 75e5fd6f..743f02bd 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/AbnormalBillMapper.java @@ -20,4 +20,12 @@ import java.util.List; public interface AbnormalBillMapper extends BaseMapper { List backLog(@Param("abnormalBill")AbnormalBillDto abnormalBillDto, @Param("language")String language); + /** + * 设备异常响应检索用 + * @param abnormalBill + * @param language + * @return + */ + AbnormalBillDto findAllByAbnormalNoDevice(@Param("abnormalBill")AbnormalBill abnormalBill, @Param("language")String language); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java index 4b39336f..a80c2d26 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java @@ -48,7 +48,7 @@ public interface AbnormalBillService extends IService { */ void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType); - void cancelBrowse(String handle,String cancelBrowse); + void cancelBrowse(String handle,String cancelBrowse,String code); String anomalyReportDevice(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose); @@ -68,6 +68,11 @@ public interface AbnormalBillService extends IService { */ AbnormalBillDisposeDto findAllByAbnormalNo(AbnormalBill abnormalBill); + /** + * + */ + AbnormalBillDto findAllByAbnormalNoDevice(AbnormalBill abnormalBill); + /** * 响应处理 * @param abnormalBill diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index f8636c3e..75a9ca69 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -74,9 +74,6 @@ public class AbnormalBillServiceImpl extends ServiceImpl selectPage(FrontPage frontPage, AbnormalBill abnormalBill) { QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -218,6 +216,14 @@ public class AbnormalBillServiceImpl extends ServiceImpl dutyTypeList = dataFieldListService.findDataFieldListById(dataField); hashMap.put("dutyType",dutyTypeList); + //当前登录用户的fullName + NwaUser nwaUser = new NwaUser(); + nwaUser.setSite(site); + nwaUser.setUserName(CommonMethods.getUser()); + List nwaUsers = nwaUserService.selectList(nwaUser); + if(nwaUsers != null){ + hashMap.put("currentUser",nwaUsers.get(0).getFullName()); + } return hashMap; } @@ -240,10 +246,24 @@ public class AbnormalBillServiceImpl extends ServiceImpl 0){ abnormalDutyService.saveOrUpdateBatch(dutyTypes); @@ -483,14 +502,16 @@ public class AbnormalBillServiceImpl extends ServiceImpl - + @@ -61,6 +61,8 @@ + + @@ -616,7 +618,7 @@ ZAB."TYPE" "TYPE" ,ZAB.SFC SFC,ZAB.MESSAGE_TYPE MESSAGE_TYPE,ZAB.SHOP_ORDER SHOP_ORDER, ZAB.WORK_CENTER WORK_CENTER,ZAB.RESRCE RESRCE, WORKORDER.VALUE WORK_ORDER,ITEMNUMBER.VALUE ITEM_NUMBER, PRODUCTCATEGORY.VALUE PRODUCT_CATEGORY,listagg(NCT2.DESCRIPTION || '/'||NCT.DESCRIPTION || ',') within GROUP(ORDER BY zab.ABNORMAL_NO) NC_CODE , ZAB.PB_DESCRIPTION PB_DESCRIPTION ,ZAB.NC_QTY NC_QTY, - ZAB.PB_GRADE PB_GRADE ,ZAB.PB_USER PB_USER ,ZAB.PB_QTY PB_QTY ,ZAB.DISCOVER DISCOVER , + ZAB.PB_GRADE PB_GRADE ,NWA.FULL_NAME PB_USER ,ZAB.PB_QTY PB_QTY ,ZAB.DISCOVER DISCOVER , ZAB.INSPECTOR INSPECTOR ,ZAB.ENTITY_LOCATION ENTITY_LOCATION ,ZAB.REPORT_FROM REPORT_FROM ,ZAB.OBJECT_BO OBJECT_BO , ZAB.PB_PHOTOSHOP PB_PHOTOSHOP,ZABD.DUTY_CAUSE_DESCRIPTION DUTY_CAUSE_DESCRIPTION,ZABD.DUTY_CAUSE_TYPE DUTY_CAUSE_TYPE,ZABD.DUTY_DEPART DUTY_DEPART, ZABD.DUTY_SEND_USER_GROUP DUTY_SEND_USER_GROUP,ZABD.DUTY_TYPE DUTY_TYPE,ZABD.PRINCIPAL_USER PRINCIPAL_USER,ZABD.ABNORMAL_METHOD ABNORMAL_METHOD, @@ -634,6 +636,7 @@ LEFT JOIN CUSTOM_FIELDS "MAP" ON "MAP".HANDLE = SO.HANDLE AND "MAP"."ATTRIBUTE" = 'MAP' LEFT JOIN Z_ABNORMAL_NC_CODE ZANC ON ZAB.HANDLE = ZANC.ABNORMAL_BILL_BO LEFT JOIN NC_CODE_T NCT ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE) = NCT.NC_CODE_BO AND NCT.LOCALE = #{language} + INNER JOIN Z_NWA_USER NWA ON NWA.USER_NAME = ZAB.PB_USER AND NWA.SITE = ZAB.SITE LEFT JOIN NC_CODE_T NCT2 ON ('NCCodeBO:' || ZAB.SITE || ',' || ZANC.NC_CODE_GROUP) = NCT2.NC_CODE_BO AND NCT2.LOCALE = #{language} LEFT JOIN ROUTER R ON SUBSTR(R.HANDLE,1,INSTR(R.HANDLE,',',-1)-1) = SUBSTR(ZABD.ROUTER_BO,1,INSTR(ZABD.ROUTER_BO,',',-1)-1) AND R.CURRENT_REVISION = 'true' @@ -651,11 +654,14 @@ ZAB."TYPE" ,ZAB.SFC ,ZAB.MESSAGE_TYPE ,ZAB.SHOP_ORDER , ZAB.WORK_CENTER ,ZAB.RESRCE , WORKORDER.VALUE ,ITEMNUMBER.VALUE , PRODUCTCATEGORY.VALUE, ZAB.PB_DESCRIPTION ,ZAB.NC_QTY , - ZAB.PB_GRADE ,ZAB.PB_USER ,ZAB.PB_QTY ,ZAB.DISCOVER , + ZAB.PB_GRADE ,NWA.FULL_NAME ,ZAB.PB_QTY ,ZAB.DISCOVER , ZAB.INSPECTOR ,ZAB.ENTITY_LOCATION ,ZAB.REPORT_FROM ,ZAB.OBJECT_BO , ZAB.PB_PHOTOSHOP ,ZABD.DUTY_CAUSE_DESCRIPTION ,ZABD.DUTY_CAUSE_TYPE ,ZABD.DUTY_DEPART , ZABD.DUTY_SEND_USER_GROUP ,ZABD.DUTY_TYPE ,ZABD.PRINCIPAL_USER ,ZABD.ABNORMAL_METHOD , R.ROUTER ,ZABD.RESOLVE_SHOP_ORDER ,ZABD.RESOLVE_REMARK ,ZABD.RESOLVE_SEND_USER , ZABD.ABNORMAL_REASON ,ZABD.BEFORE_MEASURE ,"MAP".VALUE,ZABD.ROUTER_BO + + + diff --git a/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml b/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml index 8ea13891..8e48fcd5 100644 --- a/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml +++ b/anomaly/src/main/resources/mapper/AbnormalBillMapper.xml @@ -46,6 +46,15 @@ + + + + + + + + + @@ -850,5 +859,30 @@ - + diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java index 5c83288f..d6372a2f 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java @@ -1,5 +1,6 @@ package com.foreverwin.mesnac.dispatch.mapper; +import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.dispatch.model.SfcDispatch; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease; @@ -37,5 +38,7 @@ public interface SfcDispatchMapper extends BaseMapper { @Param("dispatchNo") String dispatchNo, @Param("dispatchStatus") String dispatchStatus, @Param("modifyUser") String modifyUser, - @Param("modifiedDateTime") LocalDateTime modifiedDateTime); + @Param("modifyDateTime") LocalDateTime modifiedDateTime); + + SfcDispatchDto findResrceBySfc(@Param("sfcDispatch")SfcDispatchDto sfcDispatch, @Param("site") String site, @Param("array") String[] array); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index 747c04d1..8afec308 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -8,19 +8,20 @@ import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.mesnac.common.util.ExcelUtils; import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.dispatch.mapper.SfcDispatchMapper; +import com.foreverwin.mesnac.dispatch.model.SfcDispatch; import com.foreverwin.mesnac.dispatch.model.ShopOrderRelease; import com.foreverwin.mesnac.dispatch.model.UserResource; import com.foreverwin.mesnac.dispatch.service.CallItemService; -import com.foreverwin.mesnac.dispatch.mapper.SfcDispatchMapper; -import com.foreverwin.mesnac.dispatch.model.SfcDispatch; import com.foreverwin.mesnac.dispatch.service.SfcDispatchService; import com.foreverwin.mesnac.dispatch.service.UserResourceService; import com.foreverwin.mesnac.meapi.service.ResrceService; import com.foreverwin.mesnac.meapi.util.StringUtils; import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.CommonMethods; import org.apache.commons.fileupload.FileItem; -import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -195,6 +196,8 @@ public class SfcDispatchServiceImpl extends ServiceImpl + + diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/dto/ShopOrderDto.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/dto/ShopOrderDto.java index 5013a0ba..bdac713a 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/dto/ShopOrderDto.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/dto/ShopOrderDto.java @@ -23,6 +23,11 @@ public class ShopOrderDto extends ShopOrder { */ private String productCategory; + /** + * 工作中心 + */ + private String workCenter; + public String getWorkOrder() { return workOrder; } @@ -46,4 +51,12 @@ public class ShopOrderDto extends ShopOrder { public void setProductCategory(String productCategory) { this.productCategory = productCategory; } + + public String getWorkCenter() { + return workCenter; + } + + public void setWorkCenter(String workCenter) { + this.workCenter = workCenter; + } } diff --git a/meapi/src/main/resources/mapper/ShopOrderMapper.xml b/meapi/src/main/resources/mapper/ShopOrderMapper.xml index 4d917bf5..f9651250 100644 --- a/meapi/src/main/resources/mapper/ShopOrderMapper.xml +++ b/meapi/src/main/resources/mapper/ShopOrderMapper.xml @@ -65,6 +65,7 @@ + @@ -1008,11 +1009,12 @@ From 0d49a71fe4b77727ca1ef72fe65cc9660e0d939e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Sat, 10 Jul 2021 08:40:19 +0800 Subject: [PATCH 3/9] =?UTF-8?q?7=E6=9C=889=E6=97=A5=EF=BC=8C=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=BC=82=E5=B8=B8=E5=93=8D=E5=BA=94=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=EF=BC=8C=E5=92=8C=E5=BC=82=E5=B8=B8=E6=8F=90=E6=8A=A5=E3=80=81?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9Bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/foreverwin/mesnac/common/dto/SfcDispatchDto.java | 2 +- .../mesnac/common/service/SfcDispatchCommonService.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/dto/SfcDispatchDto.java b/common/src/main/java/com/foreverwin/mesnac/common/dto/SfcDispatchDto.java index bae3f554..5881700c 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/dto/SfcDispatchDto.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/dto/SfcDispatchDto.java @@ -13,7 +13,7 @@ import java.util.Date; * @author Leon * @date 2021-06-24 */ -public class SfcDispatchDto implements Serializable { +public class SfcDispatchDto implements Serializable{ /** * 主键 diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java index 562dfdde..1839cbfd 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/SfcDispatchCommonService.java @@ -1,5 +1,7 @@ package com.foreverwin.mesnac.common.service; +import com.foreverwin.mesnac.common.dto.SfcDispatchDto; + /** * 派工公用接口 * @@ -18,4 +20,11 @@ public interface SfcDispatchCommonService { * @param dispatchStatus */ void updateSfcDispatchStatus(String site, String user, String dispatchNo, String dispatchStatus); + + /** + * 根据sfc查询设备 + * @param sfcDispatch + * @return + */ + SfcDispatchDto findResrceBySfc(SfcDispatchDto sfcDispatch); } From 1e35a785377681d7a8805ae9f6e863dd502f4cba Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Sat, 10 Jul 2021 13:16:50 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=A3=80=E9=AA=8C=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/common/constant/Constants.java | 5 ++ .../mesnac/common/enums/HandleEnum.java | 3 + .../mesnac/common/service/CommonService.java | 4 + .../service/impl/CommonServiceImpl.java | 37 ++++++++ meapi/src/main/resources/mapper/SfcMapper.xml | 2 +- .../controller/LoadInventoryController.java | 23 +++-- .../production/dto/LoadInventoryDto.java | 42 +++++++++ .../mapper/LoadInventoryMapper.java | 3 +- .../production/model/LoadInventory.java | 13 +-- .../production/model/LoadInventoryLog.java | 13 +-- .../service/LoadInventoryService.java | 8 +- .../impl/LoadInventoryServiceImpl.java | 89 ++++++++++++++++++- .../resources/mapper/LoadInventoryMapper.xml | 10 ++- .../main/resources/mapper/SfcCrossMapper.xml | 4 +- 14 files changed, 227 insertions(+), 29 deletions(-) create mode 100644 production/src/main/java/com/foreverwin/mesnac/production/dto/LoadInventoryDto.java diff --git a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java index ab2fbfa4..1b3e4f95 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/constant/Constants.java @@ -32,6 +32,11 @@ public interface Constants { String SITE_ADMIN = "SITE_ADMIN"; + //上料 + String ACTION_CODE_LOAD="1"; + //卸料 + String ACTION_CODE_UNLOAD="2"; + //--------------------检验项目|任务----------------------------------------------------------------------------------- // 新建 String INSPECTION_TASK_STATUS_NEW="NEW"; 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 6ce621e9..6a5d8eed 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 @@ -126,6 +126,9 @@ public enum HandleEnum { /**检验任务明细**/ INSPECTION_TASK_DETAIL("InspectionTaskDetailBO:","InspectionTaskDetailBO:{0},{1}"), + /**上料**/ + LOAD_INVENTORY("LoadInventoryBO:","LoadInventoryBO:{0},{1}"), + /**用户**/ USR("UserBo","UserBo:{0},{1}"); diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/CommonService.java b/common/src/main/java/com/foreverwin/mesnac/common/service/CommonService.java index bb64da5a..785bd6c3 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/CommonService.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/CommonService.java @@ -2,6 +2,8 @@ package com.foreverwin.mesnac.common.service; import com.foreverwin.mesnac.meapi.model.Operation; +import java.math.BigDecimal; + public interface CommonService { /** * 根据资源或工作中心查找车间 @@ -16,4 +18,6 @@ public interface CommonService { * @return */ Operation getOperationBySfcBo(String sfcBo); + + void updateInventory(String site, String inventoryId, BigDecimal measuredQty); } diff --git a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/CommonServiceImpl.java b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/CommonServiceImpl.java index 075eee47..1b73e4da 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/service/impl/CommonServiceImpl.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/service/impl/CommonServiceImpl.java @@ -3,6 +3,7 @@ package com.foreverwin.mesnac.common.service.impl; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.foreverwin.mesnac.common.service.CommonService; +import com.foreverwin.mesnac.common.util.ExceptionUtil; import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.meapi.mapper.OperationMapper; import com.foreverwin.mesnac.meapi.model.Operation; @@ -11,11 +12,17 @@ import com.foreverwin.mesnac.meapi.model.WorkCenterMember; import com.foreverwin.mesnac.meapi.service.WorkCenterMemberService; import com.foreverwin.mesnac.meapi.service.WorkCenterService; import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.meext.MEServices; +import com.sap.me.inventory.InventoryIdentifier; +import com.sap.me.inventory.InventoryServiceInterface; +import com.sap.me.inventory.InventoryStatusEnum; +import com.sap.me.inventory.InventoryValidateAndUpdateRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.util.List; @Service @Transactional(rollbackFor = Exception.class) @@ -59,4 +66,34 @@ public class CommonServiceImpl implements CommonService { Operation operation = operationMapper.selectOperationBySfcBo(sfcBo, LocaleContextHolder.getLocale().getLanguage()); return operation; } + @Override + public void updateInventory(String site, String inventoryId, BigDecimal measuredQty) { + try { + InventoryServiceInterface inventoryService = MEServices.create("com.sap.me.inventory", "InventoryService", site); + com.sap.me.inventory.Inventory inventory = inventoryService.findInventory(new InventoryIdentifier(inventoryId)); + if (inventory != null) { + InventoryValidateAndUpdateRequest updateRequest = new InventoryValidateAndUpdateRequest(); + updateRequest.setInventoryId(inventory.getInventoryId()); + updateRequest.setItemRef(inventory.getItemRef()); + updateRequest.setQuantityOnHand(measuredQty); + updateRequest.setStatus(InventoryStatusEnum.AVAILABLE); + updateRequest.setAssyDataTypeRef(inventory.getAssyDataTypeRef()); + updateRequest.setOperationLocationRef(inventory.getOperationLocRef()); + updateRequest.setOperationLocationReserve(inventory.isOperationLocRes()); + updateRequest.setShopOrderLocationRef(inventory.getShopOrderLocRef()); + updateRequest.setShopOrderLocationReserve(inventory.isShopOrderLocRes()); + updateRequest.setWorkCenterLocationRef(inventory.getWorkCenterLocRef()); + updateRequest.setWorkCenterLocationReserve(inventory.isWorkCenterLocRes()); + updateRequest.setResourceLocationRef(inventory.getResourceLocRef()); + updateRequest.setResourceLocationReserve(inventory.isResourceLocRes()); + updateRequest.setStorageLocationRef(inventory.getStorageLocationRef()); + updateRequest.setAssemblyDataList(inventory.getAssemblyDataList()); + updateRequest.setModifiedDateTime(inventory.getModifiedDateTime()); + inventoryService.validateAndUpdate(updateRequest); + } + } catch (Exception e) { + e.printStackTrace(); + ExceptionUtil.throwException(e); + } + } } diff --git a/meapi/src/main/resources/mapper/SfcMapper.xml b/meapi/src/main/resources/mapper/SfcMapper.xml index 8c683e9e..5abc2826 100644 --- a/meapi/src/main/resources/mapper/SfcMapper.xml +++ b/meapi/src/main/resources/mapper/SfcMapper.xml @@ -666,7 +666,7 @@ - + diff --git a/production/src/main/resources/mapper/SfcCrossMapper.xml b/production/src/main/resources/mapper/SfcCrossMapper.xml index 496f31d7..44d4c30d 100644 --- a/production/src/main/resources/mapper/SfcCrossMapper.xml +++ b/production/src/main/resources/mapper/SfcCrossMapper.xml @@ -135,7 +135,7 @@ WHERE sfc.site = #{site} and WHEN SSTEP.QTY_IN_QUEUE > 0 THEN '排队中' ELSE '新建' END STEP_STATUS FROM SFC S - LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.HANDLE AND IT.LOCALE='zh' + LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.ITEM_BO AND IT.LOCALE='zh' INNER JOIN SFC_ROUTING SRI ON S.HANDLE=SRI.SFC_BO INNER JOIN SFC_ROUTER SR ON SRI.HANDLE=SR.SFC_ROUTING_BO AND SR.IN_USE='true' INNER JOIN ROUTER_STEP RS ON RS.ROUTER_BO=sr.ROUTER_BO @@ -154,7 +154,7 @@ WHERE sfc.site = #{site} and SELECT ZSD.sfc,ZSD.operation,IT.DESCRIPTION item_Description,ST.STATUS,s.qty,ZSD.DISPATCH_NO,ZSD.STEP_ID FROM Z_SFC_DISPATCH ZSD JOIN SFC S ON ZSD.SFC=s.SFC AND ZSD.SITE=s.SITE - LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.HANDLE AND IT.LOCALE=#{locale} + LEFT JOIN ITEM_T IT ON S.ITEM_BO=IT.ITEM_BO AND IT.LOCALE=#{locale} INNER JOIN STATUS ST ON ST.HANDLE = S.STATUS_BO WHERE zsd.SITE=#{site} AND zsd.DISPATCH_STATUS='START' AND ZSD.RESRCE=#{resrce} From 8777d65d438b053f579759d60178e985291dbafa Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Sat, 10 Jul 2021 13:33:02 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E4=BD=99=E6=96=99=E6=A0=87=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IssueItemController.java | 40 ++ .../SurplusItemReturnController.java | 51 ++ .../dispatch/mapper/IssueItemMapper.java | 18 + .../mapper/SurplusItemReturnMapper.java | 28 + .../mesnac/dispatch/model/IssueItem.java | 232 +++++++ .../dispatch/model/SurplusItemReturn.java | 233 +++++++ .../dispatch/service/IssueItemService.java | 20 + .../dispatch/service/ItemBatchService.java | 14 +- .../service/SurplusItemReturnService.java | 29 + .../service/impl/IssueItemServiceImpl.java | 81 +++ .../service/impl/ItemBatchServiceImpl.java | 30 +- .../impl/SurplusItemReturnServiceImpl.java | 73 ++ .../main/resources/mapper/IssueItemMapper.xml | 388 +++++++++++ .../mapper/SurplusItemReturnMapper.xml | 444 ++++++++++++ .../minth/generator/GeneratorApplication.java | 6 +- .../service/impl/InterfaceServiceImpl.java | 6 +- .../mesnac/meapi/mapper/InventoryMapper.java | 18 + .../mesnac/meapi/mapper/ItemMapper.java | 23 - .../mesnac/meapi/model/Inventory.java | 443 ++++++++++++ .../meapi/service/InventoryService.java | 28 + .../mesnac/meapi/service/ItemService.java | 30 - .../service/impl/InventoryServiceImpl.java | 46 ++ .../meapi/service/impl/ItemServiceImpl.java | 91 --- .../main/resources/mapper/InventoryMapper.xml | 654 ++++++++++++++++++ .../src/main/resources/mapper/ItemMapper.xml | 4 +- 25 files changed, 2854 insertions(+), 176 deletions(-) create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/IssueItemController.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SurplusItemReturnController.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/IssueItemMapper.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SurplusItemReturnMapper.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/IssueItem.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SurplusItemReturn.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/IssueItemService.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/SurplusItemReturnService.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java create mode 100644 dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java create mode 100644 dispatch/src/main/resources/mapper/IssueItemMapper.xml create mode 100644 dispatch/src/main/resources/mapper/SurplusItemReturnMapper.xml create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/InventoryMapper.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Inventory.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/service/InventoryService.java create mode 100644 meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/InventoryServiceImpl.java create mode 100644 meapi/src/main/resources/mapper/InventoryMapper.xml diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/IssueItemController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/IssueItemController.java new file mode 100644 index 00000000..b74f6038 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/IssueItemController.java @@ -0,0 +1,40 @@ +package com.foreverwin.mesnac.dispatch.controller; + +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 org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.foreverwin.mesnac.dispatch.service.IssueItemService; +import com.foreverwin.mesnac.dispatch.model.IssueItem; +import java.util.List; + +/** + * + * @author Leon.L + * @since 2021-07-09 + */ +@RestController +@RequestMapping("/Z-ISSUE-ITEM") +public class IssueItemController { + + @Autowired + public IssueItemService issueItemService; + + @ResponseBody + @GetMapping("/scanIssueInventory") + public R scanIssueInventory(String item, String inventory){ + try { + String site = CommonMethods.getSite(); + issueItemService.scanIssueInventory(site, item, inventory); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + return R.ok(); + } +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SurplusItemReturnController.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SurplusItemReturnController.java new file mode 100644 index 00000000..22a6c699 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/controller/SurplusItemReturnController.java @@ -0,0 +1,51 @@ +package com.foreverwin.mesnac.dispatch.controller; + +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.modular.core.exception.BusinessException; +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 org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; +import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; +import java.util.List; +import java.util.Map; + +/** + * + * @author Leon.L + * @since 2021-07-10 + */ +@RestController +@RequestMapping("/Z-SURPLUS-ITEM-RETURN") +public class SurplusItemReturnController { + + @Autowired + public SurplusItemReturnService surplusItemReturnService; + + + @ResponseBody + @GetMapping("/{inventory:.+}") + public R getInventoryData(@PathVariable String inventory) { + Map result; + + try { + if (StringUtil.isBlank(inventory)) { + throw BusinessException.build("物料条码不能为空!"); + } + + String site = CommonMethods.getSite(); + result = surplusItemReturnService.getInventoryData(site, inventory); + } catch (Exception e) { + return R.failed(e.getMessage()); + } + + return R.ok(result); + } + +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/IssueItemMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/IssueItemMapper.java new file mode 100644 index 00000000..96b29fa7 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/IssueItemMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.dispatch.mapper; + +import com.foreverwin.mesnac.dispatch.model.IssueItem; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 车间发料 Mapper 接口 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +@Repository +public interface IssueItemMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SurplusItemReturnMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SurplusItemReturnMapper.java new file mode 100644 index 00000000..ae208394 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SurplusItemReturnMapper.java @@ -0,0 +1,28 @@ +package com.foreverwin.mesnac.dispatch.mapper; + +import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.Map; + +/** + *

+ * 余料退回 Mapper 接口 + *

+ * + * @author Leon.L + * @since 2021-07-10 + */ +@Repository +public interface SurplusItemReturnMapper extends BaseMapper { + + /** + * 查询库存信息 + * + * @param inventoryBo + * @return + */ + Map selectInventoryData(@Param("inventoryBo") String inventoryBo); +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/IssueItem.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/IssueItem.java new file mode 100644 index 00000000..f23c701e --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/IssueItem.java @@ -0,0 +1,232 @@ +package com.foreverwin.mesnac.dispatch.model; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; + +/** + *

+ * 车间发料 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ + +@TableName("Z_ISSUE_ITEM") + +public class IssueItem extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableField("HANDLE") + private String handle; + /** + * 站点 + */ + @TableField("SITE") + private String site; + /** + * 叫料单号 + */ + @TableField("CALL_ITEM_NO") + private String callItemNo; + /** + * 生产批次 + */ + @TableField("SHOP_ORDER") + private String shopOrder; + /** + * 生产批次 + */ + @TableField("SFC") + private String sfc; + /** + * 组件物料 + */ + @TableField("ITEM") + private String item; + /** + * 库存编号 + */ + @TableField("INVENTORY") + private String inventory; + /** + * 发料数量 + */ + @TableField("QTY") + private Double qty; + /** + * 创建用户 + */ + @TableField("CREATE_USER") + private String createUser; + /** + * 创建时间 + */ + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + /** + * 更新用户 + */ + @TableField("MODIFY_USER") + private String modifyUser; + /** + * 更新时间 + */ + @TableField("MODIFIED_DATE_TIME") + private LocalDateTime modifiedDateTime; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getCallItemNo() { + return callItemNo; + } + + public void setCallItemNo(String callItemNo) { + this.callItemNo = callItemNo; + } + + public String getShopOrder() { + return shopOrder; + } + + public void setShopOrder(String shopOrder) { + this.shopOrder = shopOrder; + } + + public String getSfc() { + return sfc; + } + + public void setSfc(String sfc) { + this.sfc = sfc; + } + + public String getItem() { + return item; + } + + public void setItem(String item) { + this.item = item; + } + + public String getInventory() { + return inventory; + } + + public void setInventory(String inventory) { + this.inventory = inventory; + } + + public Double getQty() { + return qty; + } + + public void setQty(Double qty) { + this.qty = qty; + } + + public String getCreateUser() { + return createUser; + } + + public void setCreateUser(String createUser) { + this.createUser = createUser; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public String getModifyUser() { + return modifyUser; + } + + public void setModifyUser(String modifyUser) { + this.modifyUser = modifyUser; + } + + public LocalDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + +public static final String HANDLE = "HANDLE"; + +public static final String SITE = "SITE"; + +public static final String CALL_ITEM_NO = "CALL_ITEM_NO"; + +public static final String SHOP_ORDER = "SHOP_ORDER"; + +public static final String SFC = "SFC"; + +public static final String ITEM = "ITEM"; + +public static final String INVENTORY = "INVENTORY"; + +public static final String QTY = "QTY"; + +public static final String CREATE_USER = "CREATE_USER"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + +public static final String MODIFY_USER = "MODIFY_USER"; + +public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "IssueItem{" + + "handle = " + handle + + ", site = " + site + + ", callItemNo = " + callItemNo + + ", shopOrder = " + shopOrder + + ", sfc = " + sfc + + ", item = " + item + + ", inventory = " + inventory + + ", qty = " + qty + + ", createUser = " + createUser + + ", createdDateTime = " + createdDateTime + + ", modifyUser = " + modifyUser + + ", modifiedDateTime = " + modifiedDateTime + + "}"; + } +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SurplusItemReturn.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SurplusItemReturn.java new file mode 100644 index 00000000..e1205e64 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/model/SurplusItemReturn.java @@ -0,0 +1,233 @@ +package com.foreverwin.mesnac.dispatch.model; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; + +/** + *

+ * 余料退回 + *

+ * + * @author Leon.L + * @since 2021-07-10 + */ + +@TableName("Z_SURPLUS_ITEM_RETURN") + +public class SurplusItemReturn extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + /** + * 站点 + */ + @TableField("SITE") + private String site; + /** + * 库存批次 + */ + @TableField("INVENTORY") + private String inventory; + /** + * 父库存批次 + */ + @TableField("PARENT_INVENTORY") + private String parentInventory; + /** + * 物料编号 + */ + @TableField("ITEM_BO") + private String itemBo; + /** + * 余料长度 + */ + @TableField("LENGHT") + private Double lenght; + /** + * 余料宽度 + */ + @TableField("WIDTH") + private Double width; + /** + * 余料数量 + */ + @TableField("QTY") + private Double qty; + /** + * 创建用户 + */ + @TableField("CREATE_USER_BO") + private String createUserBo; + /** + * 创建时间 + */ + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + /** + * 更新用户 + */ + @TableField("UPDATE_USER_BO") + private String updateUserBo; + /** + * 更新时间 + */ + @TableField("UPDATED_DATE_TIME") + private LocalDateTime updatedDateTime; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getInventory() { + return inventory; + } + + public void setInventory(String inventory) { + this.inventory = inventory; + } + + public String getParentInventory() { + return parentInventory; + } + + public void setParentInventory(String parentInventory) { + this.parentInventory = parentInventory; + } + + public String getItemBo() { + return itemBo; + } + + public void setItemBo(String itemBo) { + this.itemBo = itemBo; + } + + public Double getLenght() { + return lenght; + } + + public void setLenght(Double lenght) { + this.lenght = lenght; + } + + public Double getWidth() { + return width; + } + + public void setWidth(Double width) { + this.width = width; + } + + public Double getQty() { + return qty; + } + + public void setQty(Double qty) { + this.qty = qty; + } + + public String getCreateUserBo() { + return createUserBo; + } + + public void setCreateUserBo(String createUserBo) { + this.createUserBo = createUserBo; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public String getUpdateUserBo() { + return updateUserBo; + } + + public void setUpdateUserBo(String updateUserBo) { + this.updateUserBo = updateUserBo; + } + + public LocalDateTime getUpdatedDateTime() { + return updatedDateTime; + } + + public void setUpdatedDateTime(LocalDateTime updatedDateTime) { + this.updatedDateTime = updatedDateTime; + } + +public static final String HANDLE = "HANDLE"; + +public static final String SITE = "SITE"; + +public static final String INVENTORY = "INVENTORY"; + +public static final String PARENT_INVENTORY = "PARENT_INVENTORY"; + +public static final String ITEM_BO = "ITEM_BO"; + +public static final String LENGHT = "LENGHT"; + +public static final String WIDTH = "WIDTH"; + +public static final String QTY = "QTY"; + +public static final String CREATE_USER_BO = "CREATE_USER_BO"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + +public static final String UPDATE_USER_BO = "UPDATE_USER_BO"; + +public static final String UPDATED_DATE_TIME = "UPDATED_DATE_TIME"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "SurplusItemReturn{" + + "handle = " + handle + + ", site = " + site + + ", inventory = " + inventory + + ", parentInventory = " + parentInventory + + ", itemBo = " + itemBo + + ", lenght = " + lenght + + ", width = " + width + + ", qty = " + qty + + ", createUserBo = " + createUserBo + + ", createdDateTime = " + createdDateTime + + ", updateUserBo = " + updateUserBo + + ", updatedDateTime = " + updatedDateTime + + "}"; + } +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/IssueItemService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/IssueItemService.java new file mode 100644 index 00000000..2821e334 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/IssueItemService.java @@ -0,0 +1,20 @@ +package com.foreverwin.mesnac.dispatch.service; +; +import com.foreverwin.mesnac.dispatch.model.IssueItem; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; + + +/** + *

+ * 车间发料 服务类 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +public interface IssueItemService extends IService { + + Map scanIssueInventory(String site, String item, String inventory); +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ItemBatchService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ItemBatchService.java index cfc4c793..a923f461 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ItemBatchService.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/ItemBatchService.java @@ -1,9 +1,8 @@ package com.foreverwin.mesnac.dispatch.service; -import com.baomidou.mybatisplus.core.metadata.IPage; + import com.foreverwin.mesnac.dispatch.model.ItemBatch; import com.baomidou.mybatisplus.extension.service.IService; -import com.foreverwin.modular.core.util.FrontPage; import java.util.List; @@ -18,11 +17,12 @@ import java.util.List; public interface ItemBatchService extends IService { /** - * 分页查询 - * @param frontPage + * 查询原材料的收获批次 + * + * @param site + * @param item + * @param batch * @return */ - IPage selectPage(FrontPage frontPage, ItemBatch itemBatch); - - List selectList(ItemBatch itemBatch); + List findItemBatch(String site, String item, String batch); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/SurplusItemReturnService.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/SurplusItemReturnService.java new file mode 100644 index 00000000..808ff269 --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/SurplusItemReturnService.java @@ -0,0 +1,29 @@ +package com.foreverwin.mesnac.dispatch.service; + +import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.Map; + +/** + *

+ * 余料退回 服务类 + *

+ * + * @author Leon.L + * @since 2021-07-10 + */ +public interface SurplusItemReturnService extends IService { + + /** + * 查询库存信息 + * --物料编号&描述 + * --物料自定义字段 + * --库存数量 + * + * @param site + * @param inventory + * @return + */ + Map getInventoryData(String site, String inventory); +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java new file mode 100644 index 00000000..bff7c72e --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/IssueItemServiceImpl.java @@ -0,0 +1,81 @@ +package com.foreverwin.mesnac.dispatch.service.impl; + +import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.dispatch.model.IssueItem; +import com.foreverwin.mesnac.dispatch.mapper.IssueItemMapper; +import com.foreverwin.mesnac.dispatch.model.ItemBatch; +import com.foreverwin.mesnac.dispatch.service.IssueItemService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.foreverwin.mesnac.dispatch.service.ItemBatchService; +import com.foreverwin.mesnac.meapi.model.Inventory; +import com.foreverwin.mesnac.meapi.model.Item; +import com.foreverwin.mesnac.meapi.service.InventoryService; +import com.foreverwin.mesnac.meapi.service.ItemService; +import com.foreverwin.modular.core.exception.BusinessException; +import com.sap.me.common.MaterialType; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + *

+ * 车间发料 服务实现类 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class IssueItemServiceImpl extends ServiceImpl implements IssueItemService { + + @Autowired + private ItemService itemService; + @Autowired + private IssueItemMapper issueItemMapper; + @Autowired + private ItemBatchService itemBatchService; + @Autowired + private InventoryService inventoryService; + + + @Override + public Map scanIssueInventory(String site, String item, String inventory) { + Item itemModel = itemService.selectCurrent(site, item); + if (itemModel == null) { + throw BusinessException.build("物料【" +item+"】当前版本不存在!"); + } + String itemBo = itemModel.getHandle(); + String materialType = itemModel.getMaterialType(); + + Map map = new HashMap<>(); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + if (MaterialType.RAW.value().equals(materialType)){ + //原材料 + List itemBatchList = itemBatchService.findItemBatch(site, item, inventory); + if (itemBatchList == null || itemBatchList.size() <= 0) { + throw BusinessException.build("扫描的物料条码【 "+ inventory +" 】不存在!"); + } + } else { + //半成品 + String inventoryBo = HandleEnum.INVENTORY.getHandle(site, inventory); + Inventory inventoryModel = inventoryService.getById(inventoryBo); + if (inventoryModel == null) { + throw BusinessException.build("扫描的物料条码【 "+ inventory +" 】不存在!"); + } + String invItemBo = inventoryModel.getItemBo(); + if (invItemBo.equals(itemBo)) { + throw BusinessException.build("扫描的物料条码【 "+ inventory +" 】不是物料【"+ item +"】的库存!"); + } + map.put("qty", inventoryModel.getQtyOnHand()); + } + + + return map; + } +} \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/ItemBatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/ItemBatchServiceImpl.java index aa3f3fec..c11e616b 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/ItemBatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/ItemBatchServiceImpl.java @@ -1,8 +1,7 @@ package com.foreverwin.mesnac.dispatch.service.impl; -import com.foreverwin.modular.core.util.FrontPage; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; + +import com.foreverwin.mesnac.common.util.StringUtil; import com.foreverwin.mesnac.dispatch.model.ItemBatch; import com.foreverwin.mesnac.dispatch.mapper.ItemBatchMapper; import com.foreverwin.mesnac.dispatch.service.ItemBatchService; @@ -11,7 +10,11 @@ import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; import java.util.List; +import java.util.Map; + + /** *

* 物料批次表 服务实现类 @@ -28,19 +31,16 @@ public class ItemBatchServiceImpl extends ServiceImpl selectPage(FrontPage frontPage, ItemBatch itemBatch) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(itemBatch); - return super.page(frontPage.getPagePlus(), queryWrapper); - } @Override - public List selectList(ItemBatch itemBatch) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.setEntity(itemBatch); - return super.list(queryWrapper); + public List findItemBatch(String site, String item, String batch) { + Map queryMap = new HashMap<>(); + queryMap.put(ItemBatch.SITE, site); + queryMap.put(ItemBatch.ITEM, item); + if (StringUtil.notBlank(batch)) { + queryMap.put(ItemBatch.BATCH, batch); + } + + return itemBatchMapper.selectByMap(queryMap); } - - } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java new file mode 100644 index 00000000..c4052a6f --- /dev/null +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java @@ -0,0 +1,73 @@ +package com.foreverwin.mesnac.dispatch.service.impl; + +import com.foreverwin.mesnac.common.enums.HandleEnum; +import com.foreverwin.mesnac.common.util.NumberUtil; +import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.meapi.model.Inventory; +import com.foreverwin.mesnac.meapi.service.InventoryService; +import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.FrontPage; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; +import com.foreverwin.mesnac.dispatch.mapper.SurplusItemReturnMapper; +import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + *

+ * 余料退回 服务实现类 + *

+ * + * @author Leon.L + * @since 2021-07-10 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class SurplusItemReturnServiceImpl extends ServiceImpl implements SurplusItemReturnService { + + + @Autowired + private InventoryService inventoryService; + @Autowired + private SurplusItemReturnMapper surplusItemReturnMapper; + + + @Override + public Map getInventoryData(String site, String inventory) { + String inventoryBo = HandleEnum.INVENTORY.getHandle(site, inventory); + Inventory inventoryModel = inventoryService.getById(inventoryBo); + if (inventoryModel == null) { + throw BusinessException.build("物料条码【" + inventory +"】不存在!"); + } + if (inventoryModel.getQtyOnHand() <= 0) { + throw BusinessException.build("物料条码【" + inventory +"】没有可用数量!"); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Map map = surplusItemReturnMapper.selectInventoryData(inventoryBo); + if (map == null || map.size() <= 0) { + throw BusinessException.build("物料条码【" + inventory +"】不存在!"); + } + String item = (String) map.get("ITEM"); + String perMater = (String) map.get("PER_METER"); + String perSquareMeter = (String) map.get("PER_SQUARE_METER"); + if (StringUtil.isBlank(perMater) && StringUtil.isBlank(perSquareMeter)) { + throw BusinessException.build("物料【" +item+ "】的自定义字段【每米重量】和【每平米重量】都没维护!"); + } + if (StringUtil.notBlank(perMater) && !NumberUtil.isNumber(perMater)) { + throw BusinessException.build("物料【" +item+ "】的自定义字段【每米重量】只能维护数值!"); + } + if (StringUtil.notBlank(perSquareMeter) && !NumberUtil.isNumber(perSquareMeter)) { + throw BusinessException.build("物料【" +item+ "】的自定义字段【每平米重量】只能维护数值!"); + } + + return map; + } +} \ No newline at end of file diff --git a/dispatch/src/main/resources/mapper/IssueItemMapper.xml b/dispatch/src/main/resources/mapper/IssueItemMapper.xml new file mode 100644 index 00000000..05f91258 --- /dev/null +++ b/dispatch/src/main/resources/mapper/IssueItemMapper.xml @@ -0,0 +1,388 @@ + + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, CALL_ITEM_NO, SHOP_ORDER, SFC, ITEM, INVENTORY, QTY, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_ISSUE_ITEM + + HANDLE, + SITE, + CALL_ITEM_NO, + SHOP_ORDER, + SFC, + ITEM, + INVENTORY, + QTY, + CREATE_USER, + CREATED_DATE_TIME, + MODIFY_USER, + MODIFIED_DATE_TIME, + VALUES + + #{handle}, + #{site}, + #{callItemNo}, + #{shopOrder}, + #{sfc}, + #{item}, + #{inventory}, + #{qty}, + #{createUser}, + #{createdDateTime}, + #{modifyUser}, + #{modifiedDateTime}, + + + + + INSERT INTO Z_ISSUE_ITEM + + + VALUES + + #{handle}, + #{site}, + #{callItemNo}, + #{shopOrder}, + #{sfc}, + #{item}, + #{inventory}, + #{qty}, + #{createUser}, + #{createdDateTime}, + #{modifyUser}, + #{modifiedDateTime}, + + + + + + + + + + UPDATE Z_ISSUE_ITEM + HANDLE=#{et.handle}, + SITE=#{et.site}, + CALL_ITEM_NO=#{et.callItemNo}, + SHOP_ORDER=#{et.shopOrder}, + SFC=#{et.sfc}, + ITEM=#{et.item}, + INVENTORY=#{et.inventory}, + QTY=#{et.qty}, + CREATE_USER=#{et.createUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFY_USER=#{et.modifyUser}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND CALL_ITEM_NO=#{ew.entity.callItemNo} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND SFC=#{ew.entity.sfc} + AND ITEM=#{ew.entity.item} + AND INVENTORY=#{ew.entity.inventory} + AND QTY=#{ew.entity.qty} + AND CREATE_USER=#{ew.entity.createUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFY_USER=#{ew.entity.modifyUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + + DELETE FROM Z_ISSUE_ITEM + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_ISSUE_ITEM + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND CALL_ITEM_NO=#{ew.entity.callItemNo} + AND SHOP_ORDER=#{ew.entity.shopOrder} + AND SFC=#{ew.entity.sfc} + AND ITEM=#{ew.entity.item} + AND INVENTORY=#{ew.entity.inventory} + AND QTY=#{ew.entity.qty} + AND CREATE_USER=#{ew.entity.createUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFY_USER=#{ew.entity.modifyUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + + diff --git a/dispatch/src/main/resources/mapper/SurplusItemReturnMapper.xml b/dispatch/src/main/resources/mapper/SurplusItemReturnMapper.xml new file mode 100644 index 00000000..026340b8 --- /dev/null +++ b/dispatch/src/main/resources/mapper/SurplusItemReturnMapper.xml @@ -0,0 +1,444 @@ + + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, INVENTORY, PARENT_INVENTORY, ITEM_BO, LENGHT, WIDTH, QTY, CREATE_USER_BO, CREATED_DATE_TIME, UPDATE_USER_BO, UPDATED_DATE_TIME + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_SURPLUS_ITEM_RETURN + + HANDLE, + SITE, + INVENTORY, + PARENT_INVENTORY, + ITEM_BO, + LENGHT, + WIDTH, + QTY, + CREATE_USER_BO, + CREATED_DATE_TIME, + UPDATE_USER_BO, + UPDATED_DATE_TIME, + VALUES + + #{handle}, + #{site}, + #{inventory}, + #{parentInventory}, + #{itemBo}, + #{lenght}, + #{width}, + #{qty}, + #{createUserBo}, + #{createdDateTime}, + #{updateUserBo}, + #{updatedDateTime}, + + + + + INSERT INTO Z_SURPLUS_ITEM_RETURN + + + VALUES + + #{handle}, + #{site}, + #{inventory}, + #{parentInventory}, + #{itemBo}, + #{lenght}, + #{width}, + #{qty}, + #{createUserBo}, + #{createdDateTime}, + #{updateUserBo}, + #{updatedDateTime}, + + + + + + UPDATE Z_SURPLUS_ITEM_RETURN + SITE=#{et.site}, + INVENTORY=#{et.inventory}, + PARENT_INVENTORY=#{et.parentInventory}, + ITEM_BO=#{et.itemBo}, + LENGHT=#{et.lenght}, + WIDTH=#{et.width}, + QTY=#{et.qty}, + CREATE_USER_BO=#{et.createUserBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATE_USER_BO=#{et.updateUserBo}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_SURPLUS_ITEM_RETURN + SITE=#{et.site}, + INVENTORY=#{et.inventory}, + PARENT_INVENTORY=#{et.parentInventory}, + ITEM_BO=#{et.itemBo}, + LENGHT=#{et.lenght}, + WIDTH=#{et.width}, + QTY=#{et.qty}, + CREATE_USER_BO=#{et.createUserBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATE_USER_BO=#{et.updateUserBo}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_SURPLUS_ITEM_RETURN + SITE=#{et.site}, + INVENTORY=#{et.inventory}, + PARENT_INVENTORY=#{et.parentInventory}, + ITEM_BO=#{et.itemBo}, + LENGHT=#{et.lenght}, + WIDTH=#{et.width}, + QTY=#{et.qty}, + CREATE_USER_BO=#{et.createUserBo}, + CREATED_DATE_TIME=#{et.createdDateTime}, + UPDATE_USER_BO=#{et.updateUserBo}, + UPDATED_DATE_TIME=#{et.updatedDateTime}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND INVENTORY=#{ew.entity.inventory} + AND PARENT_INVENTORY=#{ew.entity.parentInventory} + AND ITEM_BO=#{ew.entity.itemBo} + AND LENGHT=#{ew.entity.lenght} + AND WIDTH=#{ew.entity.width} + AND QTY=#{ew.entity.qty} + AND CREATE_USER_BO=#{ew.entity.createUserBo} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND UPDATE_USER_BO=#{ew.entity.updateUserBo} + AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_SURPLUS_ITEM_RETURN WHERE HANDLE=#{handle} + + + + DELETE FROM Z_SURPLUS_ITEM_RETURN + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_SURPLUS_ITEM_RETURN + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND INVENTORY=#{ew.entity.inventory} + AND PARENT_INVENTORY=#{ew.entity.parentInventory} + AND ITEM_BO=#{ew.entity.itemBo} + AND LENGHT=#{ew.entity.lenght} + AND WIDTH=#{ew.entity.width} + AND QTY=#{ew.entity.qty} + AND CREATE_USER_BO=#{ew.entity.createUserBo} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND UPDATE_USER_BO=#{ew.entity.updateUserBo} + AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_SURPLUS_ITEM_RETURN WHERE HANDLE IN ( + #{item} + ) + + + + + + diff --git a/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java b/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java index f359b7bf..7a8bf00d 100644 --- a/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java +++ b/generator/src/main/java/com/foreverwin/minth/generator/GeneratorApplication.java @@ -33,9 +33,9 @@ public class GeneratorApplication { dataSourceConfig.setTypeConvert( new OracleTypeConvert() ); MpGenerator mpGenerator = mpGeneratorBuilder.dataSourceConfig(dataSourceConfig) .tablePrefix( "APS_", "DS_", "Z_" ) - .packageName( "com.foreverwin.mesnac.equip" ) - .tables("Z_RESOURCE_INSPECT_TASK_SPARE") - .author("pavel.Liu") + .packageName( "com.foreverwin.mesnac.dispatch" ) + .tables("Z_SURPLUS_ITEM_RETURN") + .author("Leon.L") .uiAppId("com.foreverwin.me") .uiPackage("com.foreverwin.me.migration") .build(); diff --git a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java index cdd98084..af09dc6a 100644 --- a/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java +++ b/integration/src/main/java/com/foreverwin/mesnac/integration/service/impl/InterfaceServiceImpl.java @@ -576,11 +576,7 @@ public class InterfaceServiceImpl implements InterfaceService { String factory = itemBatchDto.getFACTORY(); //查询物料和批次是否已经存在记录 - ItemBatch queryBatch = new ItemBatch(); - queryBatch.setBatch(site); - queryBatch.setItem(item); - queryBatch.setBatch(batch); - List itemBatchList = itemBatchService.selectList(queryBatch); + List itemBatchList = itemBatchService.findItemBatch(site, item, batch); if (itemBatchList != null && itemBatchList.size() > 0) { //更新时间 ItemBatch itemBatch = itemBatchList.get(0); diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/InventoryMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/InventoryMapper.java new file mode 100644 index 00000000..1f19e8bf --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/InventoryMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.meapi.mapper; + +import com.foreverwin.mesnac.meapi.model.Inventory; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +@Repository +public interface InventoryMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/ItemMapper.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/ItemMapper.java index 4fb7b06d..450c1d44 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/ItemMapper.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/mapper/ItemMapper.java @@ -29,27 +29,4 @@ public interface ItemMapper extends BaseMapper { Item selectById(@Param("locale") String locale, @Param("handle") String handle); List selectListByCriteria(@Param("locale") String locale, @Param("ew") Wrapper wrapper); - - Item getItemDescription(@Param("item") String item,@Param("locale")String locale, @Param("site") String site); - List getItemDetailList(@Param("site") String site,@Param("local")String local); - - List selectItemControlList(@Param("locale") String locale, @Param("ew") Wrapper wrapper); - - IPagegetItemPageByProdVer(IPage page,@Param("site") String site,@Param("local")String local,@Param("query") String query); - - IPage getBklasItem(IPage page,@Param("site")String site,@Param("local")String local,@Param("itemOrDesc")String itemOrDesc); - - IPagegetRawMaterial(IPage page,@Param("site")String site,@Param("local")String local,@Param("itemOrDesc")String itemOrDesc); - - int checkItemUnit(@Param("unit")String unit,@Param("site")String site,@Param("item")String item); - - Item selectItemBo(@Param("site") String site,@Param("item") String item); - - Integer findItemNum(@Param("site") String site,@Param("item") String item); - - List selectInnerOrder(@Param("site") String site, @Param("itemBo") String handle); - - List selectItemSnp(@Param("site") String site,@Param("item") String item); - - Item selectBatchReview(@Param("site") String site,@Param("item") String item); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Inventory.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Inventory.java new file mode 100644 index 00000000..20173f52 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/model/Inventory.java @@ -0,0 +1,443 @@ +package com.foreverwin.mesnac.meapi.model; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.IdType; + +/** + *

+ * + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ + +@TableName("INVENTORY") +public class Inventory extends Model { + + private static final long serialVersionUID = 1L; + + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + @TableField("CHANGE_STAMP") + private Long changeStamp; + @TableField("SITE") + private String site; + @TableField("INVENTORY_ID") + private String inventoryId; + @TableField("ITEM_BO") + private String itemBo; + @TableField("INVENTORY_CONTEXT_GBO") + private String inventoryContextGbo; + @TableField("DESCRIPTION") + private String description; + @TableField("QTY_ON_HAND") + private Double qtyOnHand; + @TableField("ASSY_DATA_TYPE_BO") + private String assyDataTypeBo; + @TableField("USAGE_COUNT") + private Long usageCount; + @TableField("MAXIMUM_USAGE") + private Long maximumUsage; + @TableField("STATUS_BO") + private String statusBo; + @TableField("ORIGINAL_QTY") + private Double originalQty; + @TableField("WORK_CENTER_LOC_BO") + private String workCenterLocBo; + @TableField("WORK_CENTER_LOC_RES") + private String workCenterLocRes; + @TableField("OPERATION_LOC_BO") + private String operationLocBo; + @TableField("OPERATION_LOC_RES") + private String operationLocRes; + @TableField("RESOURCE_LOC_BO") + private String resourceLocBo; + @TableField("RESOURCE_LOC_RES") + private String resourceLocRes; + @TableField("SHOP_ORDER_LOC_BO") + private String shopOrderLocBo; + @TableField("SHOP_ORDER_LOC_RES") + private String shopOrderLocRes; + @TableField("SHOP_ORDER_SET_BY_ERP") + private String shopOrderSetByErp; + @TableField("ORIGINAL_USER_BO") + private String originalUserBo; + @TableField("STORAGE_LOCATION_BO") + private String storageLocationBo; + @TableField("HAS_BEEN_USED") + private String hasBeenUsed; + @TableField("RECEIVE_DATE_TIME") + private LocalDateTime receiveDateTime; + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + @TableField("MODIFIED_DATE_TIME") + private LocalDateTime modifiedDateTime; + @TableField("PARTITION_DATE") + private LocalDateTime partitionDate; + @TableField("PARENT_INVENTORY_BO") + private String parentInventoryBo; + @TableField("ERP_INVENTORY") + private String erpInventory; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public Long getChangeStamp() { + return changeStamp; + } + + public void setChangeStamp(Long changeStamp) { + this.changeStamp = changeStamp; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getInventoryId() { + return inventoryId; + } + + public void setInventoryId(String inventoryId) { + this.inventoryId = inventoryId; + } + + public String getItemBo() { + return itemBo; + } + + public void setItemBo(String itemBo) { + this.itemBo = itemBo; + } + + public String getInventoryContextGbo() { + return inventoryContextGbo; + } + + public void setInventoryContextGbo(String inventoryContextGbo) { + this.inventoryContextGbo = inventoryContextGbo; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Double getQtyOnHand() { + return qtyOnHand; + } + + public void setQtyOnHand(Double qtyOnHand) { + this.qtyOnHand = qtyOnHand; + } + + public String getAssyDataTypeBo() { + return assyDataTypeBo; + } + + public void setAssyDataTypeBo(String assyDataTypeBo) { + this.assyDataTypeBo = assyDataTypeBo; + } + + public Long getUsageCount() { + return usageCount; + } + + public void setUsageCount(Long usageCount) { + this.usageCount = usageCount; + } + + public Long getMaximumUsage() { + return maximumUsage; + } + + public void setMaximumUsage(Long maximumUsage) { + this.maximumUsage = maximumUsage; + } + + public String getStatusBo() { + return statusBo; + } + + public void setStatusBo(String statusBo) { + this.statusBo = statusBo; + } + + public Double getOriginalQty() { + return originalQty; + } + + public void setOriginalQty(Double originalQty) { + this.originalQty = originalQty; + } + + public String getWorkCenterLocBo() { + return workCenterLocBo; + } + + public void setWorkCenterLocBo(String workCenterLocBo) { + this.workCenterLocBo = workCenterLocBo; + } + + public String getWorkCenterLocRes() { + return workCenterLocRes; + } + + public void setWorkCenterLocRes(String workCenterLocRes) { + this.workCenterLocRes = workCenterLocRes; + } + + public String getOperationLocBo() { + return operationLocBo; + } + + public void setOperationLocBo(String operationLocBo) { + this.operationLocBo = operationLocBo; + } + + public String getOperationLocRes() { + return operationLocRes; + } + + public void setOperationLocRes(String operationLocRes) { + this.operationLocRes = operationLocRes; + } + + public String getResourceLocBo() { + return resourceLocBo; + } + + public void setResourceLocBo(String resourceLocBo) { + this.resourceLocBo = resourceLocBo; + } + + public String getResourceLocRes() { + return resourceLocRes; + } + + public void setResourceLocRes(String resourceLocRes) { + this.resourceLocRes = resourceLocRes; + } + + public String getShopOrderLocBo() { + return shopOrderLocBo; + } + + public void setShopOrderLocBo(String shopOrderLocBo) { + this.shopOrderLocBo = shopOrderLocBo; + } + + public String getShopOrderLocRes() { + return shopOrderLocRes; + } + + public void setShopOrderLocRes(String shopOrderLocRes) { + this.shopOrderLocRes = shopOrderLocRes; + } + + public String getShopOrderSetByErp() { + return shopOrderSetByErp; + } + + public void setShopOrderSetByErp(String shopOrderSetByErp) { + this.shopOrderSetByErp = shopOrderSetByErp; + } + + public String getOriginalUserBo() { + return originalUserBo; + } + + public void setOriginalUserBo(String originalUserBo) { + this.originalUserBo = originalUserBo; + } + + public String getStorageLocationBo() { + return storageLocationBo; + } + + public void setStorageLocationBo(String storageLocationBo) { + this.storageLocationBo = storageLocationBo; + } + + public String getHasBeenUsed() { + return hasBeenUsed; + } + + public void setHasBeenUsed(String hasBeenUsed) { + this.hasBeenUsed = hasBeenUsed; + } + + public LocalDateTime getReceiveDateTime() { + return receiveDateTime; + } + + public void setReceiveDateTime(LocalDateTime receiveDateTime) { + this.receiveDateTime = receiveDateTime; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public LocalDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + + public LocalDateTime getPartitionDate() { + return partitionDate; + } + + public void setPartitionDate(LocalDateTime partitionDate) { + this.partitionDate = partitionDate; + } + + public String getParentInventoryBo() { + return parentInventoryBo; + } + + public void setParentInventoryBo(String parentInventoryBo) { + this.parentInventoryBo = parentInventoryBo; + } + + public String getErpInventory() { + return erpInventory; + } + + public void setErpInventory(String erpInventory) { + this.erpInventory = erpInventory; + } + +public static final String HANDLE = "HANDLE"; + +public static final String CHANGE_STAMP = "CHANGE_STAMP"; + +public static final String SITE = "SITE"; + +public static final String INVENTORY_ID = "INVENTORY_ID"; + +public static final String ITEM_BO = "ITEM_BO"; + +public static final String INVENTORY_CONTEXT_GBO = "INVENTORY_CONTEXT_GBO"; + +public static final String DESCRIPTION = "DESCRIPTION"; + +public static final String QTY_ON_HAND = "QTY_ON_HAND"; + +public static final String ASSY_DATA_TYPE_BO = "ASSY_DATA_TYPE_BO"; + +public static final String USAGE_COUNT = "USAGE_COUNT"; + +public static final String MAXIMUM_USAGE = "MAXIMUM_USAGE"; + +public static final String STATUS_BO = "STATUS_BO"; + +public static final String ORIGINAL_QTY = "ORIGINAL_QTY"; + +public static final String WORK_CENTER_LOC_BO = "WORK_CENTER_LOC_BO"; + +public static final String WORK_CENTER_LOC_RES = "WORK_CENTER_LOC_RES"; + +public static final String OPERATION_LOC_BO = "OPERATION_LOC_BO"; + +public static final String OPERATION_LOC_RES = "OPERATION_LOC_RES"; + +public static final String RESOURCE_LOC_BO = "RESOURCE_LOC_BO"; + +public static final String RESOURCE_LOC_RES = "RESOURCE_LOC_RES"; + +public static final String SHOP_ORDER_LOC_BO = "SHOP_ORDER_LOC_BO"; + +public static final String SHOP_ORDER_LOC_RES = "SHOP_ORDER_LOC_RES"; + +public static final String SHOP_ORDER_SET_BY_ERP = "SHOP_ORDER_SET_BY_ERP"; + +public static final String ORIGINAL_USER_BO = "ORIGINAL_USER_BO"; + +public static final String STORAGE_LOCATION_BO = "STORAGE_LOCATION_BO"; + +public static final String HAS_BEEN_USED = "HAS_BEEN_USED"; + +public static final String RECEIVE_DATE_TIME = "RECEIVE_DATE_TIME"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + +public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; + +public static final String PARTITION_DATE = "PARTITION_DATE"; + +public static final String PARENT_INVENTORY_BO = "PARENT_INVENTORY_BO"; + +public static final String ERP_INVENTORY = "ERP_INVENTORY"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "Inventory{" + + "handle = " + handle + + ", changeStamp = " + changeStamp + + ", site = " + site + + ", inventoryId = " + inventoryId + + ", itemBo = " + itemBo + + ", inventoryContextGbo = " + inventoryContextGbo + + ", description = " + description + + ", qtyOnHand = " + qtyOnHand + + ", assyDataTypeBo = " + assyDataTypeBo + + ", usageCount = " + usageCount + + ", maximumUsage = " + maximumUsage + + ", statusBo = " + statusBo + + ", originalQty = " + originalQty + + ", workCenterLocBo = " + workCenterLocBo + + ", workCenterLocRes = " + workCenterLocRes + + ", operationLocBo = " + operationLocBo + + ", operationLocRes = " + operationLocRes + + ", resourceLocBo = " + resourceLocBo + + ", resourceLocRes = " + resourceLocRes + + ", shopOrderLocBo = " + shopOrderLocBo + + ", shopOrderLocRes = " + shopOrderLocRes + + ", shopOrderSetByErp = " + shopOrderSetByErp + + ", originalUserBo = " + originalUserBo + + ", storageLocationBo = " + storageLocationBo + + ", hasBeenUsed = " + hasBeenUsed + + ", receiveDateTime = " + receiveDateTime + + ", createdDateTime = " + createdDateTime + + ", modifiedDateTime = " + modifiedDateTime + + ", partitionDate = " + partitionDate + + ", parentInventoryBo = " + parentInventoryBo + + ", erpInventory = " + erpInventory + + "}"; + } +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/InventoryService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/InventoryService.java new file mode 100644 index 00000000..d4c1615d --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/InventoryService.java @@ -0,0 +1,28 @@ +package com.foreverwin.mesnac.meapi.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.model.Inventory; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +public interface InventoryService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, Inventory inventory); + + List selectList(Inventory inventory); +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/ItemService.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/ItemService.java index 01384ad9..d05e2415 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/ItemService.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/ItemService.java @@ -31,41 +31,11 @@ public interface ItemService extends IService { List selectList(Item item); - List selectItemWithDesc(Item item); - - List selectItemWithDesc(QueryWrapper queryWrapper); - List selectList(Wrapper queryWrapper); - List getItemDetailList(); - - Item getItemDescription(String item); - String selectCurrent(String handle); Item selectCurrent(String site, String item); - List selectItemLabelControl(QueryWrapper queryWrapper); - - IPagegetItemPageByProdVer(IPage page, String query); - - IPage getBklasItem(IPage page,String itemOrDesc); - - IPagegetRawMaterial(IPage page,String item); - - Integer checkItemUnit(String unit,String site,String item); - - /** - * 查询物料的描述 - * @param item - * @param local - * @return - */ - Item getItemDescription(String item, String local); - - List selectInnerOrder(String site, String handle); - - List selectItemSnp(String site, String item); - Item selectBatchReview(String site, String item); } \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/InventoryServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/InventoryServiceImpl.java new file mode 100644 index 00000000..3ef7a7d1 --- /dev/null +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/InventoryServiceImpl.java @@ -0,0 +1,46 @@ +package com.foreverwin.mesnac.meapi.service.impl; + +import com.foreverwin.modular.core.util.FrontPage; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.meapi.model.Inventory; +import com.foreverwin.mesnac.meapi.mapper.InventoryMapper; +import com.foreverwin.mesnac.meapi.service.InventoryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.logging.Handler; + +/** + *

+ * 服务实现类 + *

+ * + * @author Leon.L + * @since 2021-07-09 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class InventoryServiceImpl extends ServiceImpl implements InventoryService { + + + @Autowired + private InventoryMapper inventoryMapper; + + @Override + public IPage selectPage(FrontPage frontPage, Inventory inventory) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(inventory); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(Inventory inventory) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(inventory); + return super.list(queryWrapper); + } +} \ No newline at end of file diff --git a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/ItemServiceImpl.java b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/ItemServiceImpl.java index fb267283..f3a4605e 100644 --- a/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/ItemServiceImpl.java +++ b/meapi/src/main/java/com/foreverwin/mesnac/meapi/service/impl/ItemServiceImpl.java @@ -72,40 +72,6 @@ public class ItemServiceImpl extends ServiceImpl implements It } - @Override - public List getItemDetailList() { - String site= CommonMethods.getSite(); - String local=LocaleContextHolder.getLocale().getLanguage(); - return itemMapper.getItemDetailList(site,local); - } - - @Override - public Item getItemDescription(String item) { - String site= CommonMethods.getSite(); - String local=LocaleContextHolder.getLocale().getLanguage(); - return itemMapper.getItemDescription(item,local,site); - } - - - @Override - public List selectItemWithDesc(Item item) { - Locale locale = LocaleContextHolder.getLocale(); - String site = CommonMethods.getSite(); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(Item.SITE, site); - if( item.getItem() != null){ - queryWrapper.like(Item.ITEM, item.getItem()); - } - if(item.getDescription()!= null){ - queryWrapper.like(Item.DESCRIPTION, item.getDescription()); - } - return itemMapper.selectListByCriteria(locale.getLanguage(), queryWrapper); - } - - @Override - public List selectItemWithDesc(QueryWrapper queryWrapper) { - return itemMapper.selectListByCriteria(LocaleContextHolder.getLocale().getLanguage(), queryWrapper); - } @Override public String selectCurrent(String handle){ if(handle.endsWith("#")) { @@ -129,61 +95,4 @@ public class ItemServiceImpl extends ServiceImpl implements It //---------------------------------------------------------------------------------- return resultLit != null && resultLit.size() > 0 ? resultLit.get(0) : null; } - - @Override - public List selectItemLabelControl(QueryWrapper queryWrapper) { - return itemMapper.selectItemControlList(LocaleContextHolder.getLocale().getLanguage(), queryWrapper); - } - - - - @Override - public IPage getItemPageByProdVer(IPage page, String query) { - String site=CommonMethods.getSite(); - String local=LocaleContextHolder.getLocale().getLanguage(); - - return itemMapper.getItemPageByProdVer(page,site,local,query); - } - - @Override - public IPage getBklasItem(IPage page, String itemOrDesc) { - String site=CommonMethods.getSite(); - String local=LocaleContextHolder.getLocale().getLanguage(); - return itemMapper.getBklasItem(page,site,local,itemOrDesc); - } - - - @Override - public IPage getRawMaterial(IPage page, String item) { - String local=LocaleContextHolder.getLocale().getLanguage(); - String site=CommonMethods.getSite(); - return itemMapper.getRawMaterial(page,site,local,item); - } - - @Override - public Integer checkItemUnit(String unit, String site, String item) { - return itemMapper.checkItemUnit(unit,site,item); - } - - @Override - public Item getItemDescription(String item, String local) { - String site = CommonMethods.getSite(); - return itemMapper.getItemDescription(item, local, site); - } - - @Override - public List selectInnerOrder(String site, String handle) { - return itemMapper.selectInnerOrder(site, handle); - } - - - @Override - public List selectItemSnp(String site, String item) { - return itemMapper.selectItemSnp(site, item); - } - - @Override - public Item selectBatchReview(String site, String item) { - return itemMapper.selectBatchReview(site,item); - } } \ No newline at end of file diff --git a/meapi/src/main/resources/mapper/InventoryMapper.xml b/meapi/src/main/resources/mapper/InventoryMapper.xml new file mode 100644 index 00000000..9b543b8e --- /dev/null +++ b/meapi/src/main/resources/mapper/InventoryMapper.xml @@ -0,0 +1,654 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + HANDLE, CHANGE_STAMP, SITE, INVENTORY_ID, ITEM_BO, INVENTORY_CONTEXT_GBO, DESCRIPTION, QTY_ON_HAND, ASSY_DATA_TYPE_BO, USAGE_COUNT, MAXIMUM_USAGE, STATUS_BO, ORIGINAL_QTY, WORK_CENTER_LOC_BO, WORK_CENTER_LOC_RES, OPERATION_LOC_BO, OPERATION_LOC_RES, RESOURCE_LOC_BO, RESOURCE_LOC_RES, SHOP_ORDER_LOC_BO, SHOP_ORDER_LOC_RES, SHOP_ORDER_SET_BY_ERP, ORIGINAL_USER_BO, STORAGE_LOCATION_BO, HAS_BEEN_USED, RECEIVE_DATE_TIME, CREATED_DATE_TIME, MODIFIED_DATE_TIME, PARTITION_DATE, PARENT_INVENTORY_BO, ERP_INVENTORY + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO INVENTORY + + HANDLE, + CHANGE_STAMP, + SITE, + INVENTORY_ID, + ITEM_BO, + INVENTORY_CONTEXT_GBO, + DESCRIPTION, + QTY_ON_HAND, + ASSY_DATA_TYPE_BO, + USAGE_COUNT, + MAXIMUM_USAGE, + STATUS_BO, + ORIGINAL_QTY, + WORK_CENTER_LOC_BO, + WORK_CENTER_LOC_RES, + OPERATION_LOC_BO, + OPERATION_LOC_RES, + RESOURCE_LOC_BO, + RESOURCE_LOC_RES, + SHOP_ORDER_LOC_BO, + SHOP_ORDER_LOC_RES, + SHOP_ORDER_SET_BY_ERP, + ORIGINAL_USER_BO, + STORAGE_LOCATION_BO, + HAS_BEEN_USED, + RECEIVE_DATE_TIME, + CREATED_DATE_TIME, + MODIFIED_DATE_TIME, + PARTITION_DATE, + PARENT_INVENTORY_BO, + ERP_INVENTORY, + VALUES + + #{handle}, + #{changeStamp}, + #{site}, + #{inventoryId}, + #{itemBo}, + #{inventoryContextGbo}, + #{description}, + #{qtyOnHand}, + #{assyDataTypeBo}, + #{usageCount}, + #{maximumUsage}, + #{statusBo}, + #{originalQty}, + #{workCenterLocBo}, + #{workCenterLocRes}, + #{operationLocBo}, + #{operationLocRes}, + #{resourceLocBo}, + #{resourceLocRes}, + #{shopOrderLocBo}, + #{shopOrderLocRes}, + #{shopOrderSetByErp}, + #{originalUserBo}, + #{storageLocationBo}, + #{hasBeenUsed}, + #{receiveDateTime}, + #{createdDateTime}, + #{modifiedDateTime}, + #{partitionDate}, + #{parentInventoryBo}, + #{erpInventory}, + + + + + INSERT INTO INVENTORY + + + VALUES + + #{handle}, + #{changeStamp}, + #{site}, + #{inventoryId}, + #{itemBo}, + #{inventoryContextGbo}, + #{description}, + #{qtyOnHand}, + #{assyDataTypeBo}, + #{usageCount}, + #{maximumUsage}, + #{statusBo}, + #{originalQty}, + #{workCenterLocBo}, + #{workCenterLocRes}, + #{operationLocBo}, + #{operationLocRes}, + #{resourceLocBo}, + #{resourceLocRes}, + #{shopOrderLocBo}, + #{shopOrderLocRes}, + #{shopOrderSetByErp}, + #{originalUserBo}, + #{storageLocationBo}, + #{hasBeenUsed}, + #{receiveDateTime}, + #{createdDateTime}, + #{modifiedDateTime}, + #{partitionDate}, + #{parentInventoryBo}, + #{erpInventory}, + + + + + + + + + + UPDATE INVENTORY + HANDLE=#{et.handle}, + CHANGE_STAMP=#{et.changeStamp}, + SITE=#{et.site}, + INVENTORY_ID=#{et.inventoryId}, + ITEM_BO=#{et.itemBo}, + INVENTORY_CONTEXT_GBO=#{et.inventoryContextGbo}, + DESCRIPTION=#{et.description}, + QTY_ON_HAND=#{et.qtyOnHand}, + ASSY_DATA_TYPE_BO=#{et.assyDataTypeBo}, + USAGE_COUNT=#{et.usageCount}, + MAXIMUM_USAGE=#{et.maximumUsage}, + STATUS_BO=#{et.statusBo}, + ORIGINAL_QTY=#{et.originalQty}, + WORK_CENTER_LOC_BO=#{et.workCenterLocBo}, + WORK_CENTER_LOC_RES=#{et.workCenterLocRes}, + OPERATION_LOC_BO=#{et.operationLocBo}, + OPERATION_LOC_RES=#{et.operationLocRes}, + RESOURCE_LOC_BO=#{et.resourceLocBo}, + RESOURCE_LOC_RES=#{et.resourceLocRes}, + SHOP_ORDER_LOC_BO=#{et.shopOrderLocBo}, + SHOP_ORDER_LOC_RES=#{et.shopOrderLocRes}, + SHOP_ORDER_SET_BY_ERP=#{et.shopOrderSetByErp}, + ORIGINAL_USER_BO=#{et.originalUserBo}, + STORAGE_LOCATION_BO=#{et.storageLocationBo}, + HAS_BEEN_USED=#{et.hasBeenUsed}, + RECEIVE_DATE_TIME=#{et.receiveDateTime}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + PARTITION_DATE=#{et.partitionDate}, + PARENT_INVENTORY_BO=#{et.parentInventoryBo}, + ERP_INVENTORY=#{et.erpInventory}, + + + + + HANDLE=#{ew.entity.handle} + AND CHANGE_STAMP=#{ew.entity.changeStamp} + AND SITE=#{ew.entity.site} + AND INVENTORY_ID=#{ew.entity.inventoryId} + AND ITEM_BO=#{ew.entity.itemBo} + AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo} + AND DESCRIPTION=#{ew.entity.description} + AND QTY_ON_HAND=#{ew.entity.qtyOnHand} + AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo} + AND USAGE_COUNT=#{ew.entity.usageCount} + AND MAXIMUM_USAGE=#{ew.entity.maximumUsage} + AND STATUS_BO=#{ew.entity.statusBo} + AND ORIGINAL_QTY=#{ew.entity.originalQty} + AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo} + AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes} + AND OPERATION_LOC_BO=#{ew.entity.operationLocBo} + AND OPERATION_LOC_RES=#{ew.entity.operationLocRes} + AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo} + AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes} + AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo} + AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes} + AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp} + AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo} + AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo} + AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed} + AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + AND PARTITION_DATE=#{ew.entity.partitionDate} + AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo} + AND ERP_INVENTORY=#{ew.entity.erpInventory} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + + DELETE FROM INVENTORY + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM INVENTORY + + + + + HANDLE=#{ew.entity.handle} + + AND CHANGE_STAMP=#{ew.entity.changeStamp} + AND SITE=#{ew.entity.site} + AND INVENTORY_ID=#{ew.entity.inventoryId} + AND ITEM_BO=#{ew.entity.itemBo} + AND INVENTORY_CONTEXT_GBO=#{ew.entity.inventoryContextGbo} + AND DESCRIPTION=#{ew.entity.description} + AND QTY_ON_HAND=#{ew.entity.qtyOnHand} + AND ASSY_DATA_TYPE_BO=#{ew.entity.assyDataTypeBo} + AND USAGE_COUNT=#{ew.entity.usageCount} + AND MAXIMUM_USAGE=#{ew.entity.maximumUsage} + AND STATUS_BO=#{ew.entity.statusBo} + AND ORIGINAL_QTY=#{ew.entity.originalQty} + AND WORK_CENTER_LOC_BO=#{ew.entity.workCenterLocBo} + AND WORK_CENTER_LOC_RES=#{ew.entity.workCenterLocRes} + AND OPERATION_LOC_BO=#{ew.entity.operationLocBo} + AND OPERATION_LOC_RES=#{ew.entity.operationLocRes} + AND RESOURCE_LOC_BO=#{ew.entity.resourceLocBo} + AND RESOURCE_LOC_RES=#{ew.entity.resourceLocRes} + AND SHOP_ORDER_LOC_BO=#{ew.entity.shopOrderLocBo} + AND SHOP_ORDER_LOC_RES=#{ew.entity.shopOrderLocRes} + AND SHOP_ORDER_SET_BY_ERP=#{ew.entity.shopOrderSetByErp} + AND ORIGINAL_USER_BO=#{ew.entity.originalUserBo} + AND STORAGE_LOCATION_BO=#{ew.entity.storageLocationBo} + AND HAS_BEEN_USED=#{ew.entity.hasBeenUsed} + AND RECEIVE_DATE_TIME=#{ew.entity.receiveDateTime} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + AND PARTITION_DATE=#{ew.entity.partitionDate} + AND PARENT_INVENTORY_BO=#{ew.entity.parentInventoryBo} + AND ERP_INVENTORY=#{ew.entity.erpInventory} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + + diff --git a/meapi/src/main/resources/mapper/ItemMapper.xml b/meapi/src/main/resources/mapper/ItemMapper.xml index 2b516e93..f8cdeaef 100644 --- a/meapi/src/main/resources/mapper/ItemMapper.xml +++ b/meapi/src/main/resources/mapper/ItemMapper.xml @@ -74,7 +74,7 @@ - I.HANDLE, I.CHANGE_STAMP, I.SITE, I.ITEM, IT.DESCRIPTION, I.STATUS_BO, I.ITEM_TYPE, I.ERP_GTIN, I.AIN_MODEL_EXTERNAL_ID, I.EFF_START_SEQ, I.EFF_END_SEQ, I.LOT_SIZE, I.QUANTITY_RESTRICTION, I.ROUTER_BO, I.BOM_BO, I.COMPONENT_GROUP_BO, I.ITEM_GROUP_BO, I.LAST_RELEASED_DATE, I.ASSY_DATA_TYPE_BO, I.PRE_ASSEMBLED, I.REVISION, I.CURRENT_REVISION, I.EFF_START_DATE, I.EFF_END_DATE, I.SELECTOR_ACTIVITY_BO, I.SELECTOR_NOTE, I.ASSIGN_SERIAL_AT_RELEASE, I.CREATED_DATE_TIME, I.MODIFIED_DATE_TIME, I.DRAWING_NAME, I.MAXIMUM_USAGE, I.USE_COMP_FROM_DRAWING, I.PANEL, I.REMOVAL_ASSY_DATA_TYPE_BO, I.INV_ASSY_DATA_TYPE_BO, I.ORIGINAL_STATUS_BO, I.QTY_MULTIPLIER, I.CREATE_TRACKABLE_SFC, I.MASK_GROUP_BO, I.TRANSFER_ITEM_GROUP_BO, I.UNIT_OF_MEASURE, I.HOLD_ID, I.COLLECT_PARENT_SERIAL, I.REQ_SERIAL_CHANGE, I.IS_COLLECTOR, I.INC_BATCH_NUMBER, I.TIME_SENSITIVE, I.MAX_SHELF_LIFE, I.MAX_SHELF_LIFE_UNITS, I.MAX_FLOOR_LIFE, I.MAX_FLOOR_LIFE_UNITS, I.NOTES, I.TB_COMP_TYPE, I.CONSUMPTION_TOL, I.ERP_BACKFLUSHING, I.STORAGE_LOCATION_BO, I.ERP_PUTAWAY_STORLOC, I.PRODUCTION_SUPPLY_AREA, I.USE_ORDER_ID_REL1 + I.HANDLE, I.CHANGE_STAMP, I.SITE, I.ITEM, IT.DESCRIPTION, I.STATUS_BO, I.ITEM_TYPE, I.MATERIAL_TYPE, I.ERP_GTIN, I.AIN_MODEL_EXTERNAL_ID, I.EFF_START_SEQ, I.EFF_END_SEQ, I.LOT_SIZE, I.QUANTITY_RESTRICTION, I.ROUTER_BO, I.BOM_BO, I.COMPONENT_GROUP_BO, I.ITEM_GROUP_BO, I.LAST_RELEASED_DATE, I.ASSY_DATA_TYPE_BO, I.PRE_ASSEMBLED, I.REVISION, I.CURRENT_REVISION, I.EFF_START_DATE, I.EFF_END_DATE, I.SELECTOR_ACTIVITY_BO, I.SELECTOR_NOTE, I.ASSIGN_SERIAL_AT_RELEASE, I.CREATED_DATE_TIME, I.MODIFIED_DATE_TIME, I.DRAWING_NAME, I.MAXIMUM_USAGE, I.USE_COMP_FROM_DRAWING, I.PANEL, I.REMOVAL_ASSY_DATA_TYPE_BO, I.INV_ASSY_DATA_TYPE_BO, I.ORIGINAL_STATUS_BO, I.QTY_MULTIPLIER, I.CREATE_TRACKABLE_SFC, I.MASK_GROUP_BO, I.TRANSFER_ITEM_GROUP_BO, I.UNIT_OF_MEASURE, I.HOLD_ID, I.COLLECT_PARENT_SERIAL, I.REQ_SERIAL_CHANGE, I.IS_COLLECTOR, I.INC_BATCH_NUMBER, I.TIME_SENSITIVE, I.MAX_SHELF_LIFE, I.MAX_SHELF_LIFE_UNITS, I.MAX_FLOOR_LIFE, I.MAX_FLOOR_LIFE_UNITS, I.NOTES, I.TB_COMP_TYPE, I.CONSUMPTION_TOL, I.ERP_BACKFLUSHING, I.STORAGE_LOCATION_BO, I.ERP_PUTAWAY_STORLOC, I.PRODUCTION_SUPPLY_AREA, I.USE_ORDER_ID_REL1 @@ -993,6 +993,7 @@ ${ew.sqlSegment} + - From e909e04bd1fd5ac5d6addc224759d1645e65ae9b Mon Sep 17 00:00:00 2001 From: philip <244793088@qq.com> Date: Sat, 10 Jul 2021 14:32:35 +0800 Subject: [PATCH 6/9] inventory --- .../impl/SurplusItemReturnServiceImpl.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java index c4052a6f..c0b055e8 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SurplusItemReturnServiceImpl.java @@ -1,23 +1,19 @@ package com.foreverwin.mesnac.dispatch.service.impl; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.foreverwin.mesnac.common.enums.HandleEnum; import com.foreverwin.mesnac.common.util.NumberUtil; import com.foreverwin.mesnac.common.util.StringUtil; +import com.foreverwin.mesnac.dispatch.mapper.SurplusItemReturnMapper; +import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; +import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; import com.foreverwin.mesnac.meapi.model.Inventory; import com.foreverwin.mesnac.meapi.service.InventoryService; import com.foreverwin.modular.core.exception.BusinessException; -import com.foreverwin.modular.core.util.FrontPage; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.foreverwin.mesnac.dispatch.model.SurplusItemReturn; -import com.foreverwin.mesnac.dispatch.mapper.SurplusItemReturnMapper; -import com.foreverwin.mesnac.dispatch.service.SurplusItemReturnService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.stereotype.Service; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; import java.util.Map; /** @@ -46,7 +42,7 @@ public class SurplusItemReturnServiceImpl extends ServiceImpl Date: Sat, 10 Jul 2021 17:22:33 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=B4=BE=E5=B7=A5?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/src/main/resources/mapper/ProdReadyTaskMapper.xml | 3 ++- .../foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java | 2 +- .../mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java | 4 ++++ dispatch/src/main/resources/mapper/SfcDispatchMapper.xml | 2 +- meapi/src/main/resources/mapper/BomComponentMapper.xml | 2 +- meapi/src/main/resources/mapper/CustomFieldsMapper.xml | 5 ++++- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/common/src/main/resources/mapper/ProdReadyTaskMapper.xml b/common/src/main/resources/mapper/ProdReadyTaskMapper.xml index 4a42e76e..9d1097c2 100644 --- a/common/src/main/resources/mapper/ProdReadyTaskMapper.xml +++ b/common/src/main/resources/mapper/ProdReadyTaskMapper.xml @@ -640,7 +640,8 @@ AND ZPRT.RESRCE=#{entity.resrce} AND ZSD.DISPATCH_NO=#{entity.dispatchNo} AND ZPRT.STATUS=#{entity.status} - AND ZSD.DISPATCH_STATUS=#{entity.sfcStepStatus} + AND ZSD.DISPATCH_STATUS=#{entity.sfcStepStatus} + AND ZSD.DISPATCH_STATUS!='COMPLETE' AND ZPRT.SFC=#{entity.sfc} AND ZSD.RESOURCE_TYPE=#{entity.resourceType} AND ZPRT.SHOP_ORDER=#{entity.shopOrder} diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java index d6372a2f..6f85ac8c 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/mapper/SfcDispatchMapper.java @@ -38,7 +38,7 @@ public interface SfcDispatchMapper extends BaseMapper { @Param("dispatchNo") String dispatchNo, @Param("dispatchStatus") String dispatchStatus, @Param("modifyUser") String modifyUser, - @Param("modifyDateTime") LocalDateTime modifiedDateTime); + @Param("modifiedDateTime") LocalDateTime modifiedDateTime); SfcDispatchDto findResrceBySfc(@Param("sfcDispatch")SfcDispatchDto sfcDispatch, @Param("site") String site, @Param("array") String[] array); } \ No newline at end of file diff --git a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java index 9c84e98d..3c241205 100644 --- a/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java +++ b/dispatch/src/main/java/com/foreverwin/mesnac/dispatch/service/impl/SfcDispatchServiceImpl.java @@ -173,6 +173,9 @@ public class SfcDispatchServiceImpl extends ServiceImpl 0) { @@ -341,6 +344,7 @@ public class SfcDispatchServiceImpl extends ServiceImpl AND OTHER_5=#{ew.entity.other5} - ${ew.sqlSegment} + and ${ew.sqlSegment} diff --git a/meapi/src/main/resources/mapper/BomComponentMapper.xml b/meapi/src/main/resources/mapper/BomComponentMapper.xml index 2ec58a68..1d26b7cc 100644 --- a/meapi/src/main/resources/mapper/BomComponentMapper.xml +++ b/meapi/src/main/resources/mapper/BomComponentMapper.xml @@ -691,7 +691,7 @@ WHERE PLANNED_WORK_CENTER_BO = #{workCenterBO} - SELECT RS.STEP_ID,OP.OPERATION,BC.COMPONENT_GBO,TP.VALUE ACCESSORY_TYPE FROM SFC SFC JOIN SFC_ROUTING SRI ON SRI.SFC_BO =SFC.HANDLE diff --git a/meapi/src/main/resources/mapper/CustomFieldsMapper.xml b/meapi/src/main/resources/mapper/CustomFieldsMapper.xml index 3ea4594b..e8a48103 100644 --- a/meapi/src/main/resources/mapper/CustomFieldsMapper.xml +++ b/meapi/src/main/resources/mapper/CustomFieldsMapper.xml @@ -296,5 +296,8 @@ - + From 86ee8a3f57793e30b3300bcab83e931c6781392b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=98=89=E4=BC=9F?= <1724121454@qq.com> Date: Sat, 10 Jul 2021 17:24:37 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E3=80=81=E8=AE=BE=E5=A4=87=E5=BC=82=E5=B8=B8=E3=80=81=E5=85=B6?= =?UTF-8?q?=E4=BB=96=E5=BC=82=E5=B8=B8=E7=94=9F=E6=88=90=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=8D=95=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbnormalBillController.java | 4 +-- .../anomaly/service/AbnormalBillService.java | 2 +- .../service/impl/AbnormalBillServiceImpl.java | 26 +++++++++++-------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index 29fd3b44..4311eb88 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -157,8 +157,8 @@ public class AbnormalBillController { * @return */ @GetMapping("/init") - public R init(String messageType){ - return R.ok(abnormalBillService.init(messageType)); + public R init(String messageType,String type){ + return R.ok(abnormalBillService.init(messageType,type)); } // @GetMapping("/findAllUserByUserGroup") diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java index a80c2d26..93fe07d4 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java @@ -55,7 +55,7 @@ public interface AbnormalBillService extends IService { /** * 初始化 */ - HashMap init(String messageType); + HashMap init(String messageType,String type); /** * 待办事项 * @param abnormalBillDto diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 75a9ca69..125e4ef8 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -185,7 +185,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl init(String messageType) { + public HashMap init(String messageType,String type) { HashMap hashMap = new HashMap<>(); String site = CommonMethods.getSite(); //消息类型 @@ -224,6 +224,18 @@ public class AbnormalBillServiceImpl extends ServiceImpl Date: Mon, 12 Jul 2021 09:22:07 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E9=99=84=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=EF=BC=8C=E5=BC=82=E5=B8=B8bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- anomaly/pom.xml | 5 + .../controller/AbnormalBillController.java | 22 + .../controller/UploadPicturesController.java | 124 ++++++ .../anomaly/mapper/UploadPicturesMapper.java | 18 + .../mesnac/anomaly/model/AbnormalBill.java | 34 +- .../mesnac/anomaly/model/UploadPictures.java | 216 +++++++++ .../anomaly/service/AbnormalBillService.java | 16 +- .../anomaly/service/FileUploadedService.java | 22 + .../service/UploadPicturesService.java | 28 ++ .../service/impl/AbnormalBillServiceImpl.java | 86 +++- .../service/impl/FileUploadedServiceImpl.java | 167 +++++++ .../impl/UploadPicturesServiceImpl.java | 46 ++ .../resources/mapper/UploadPicturesMapper.xml | 418 ++++++++++++++++++ .../src/main/resources/application-local.yml | 15 +- pom.xml | 6 + 15 files changed, 1204 insertions(+), 19 deletions(-) create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/UploadPicturesController.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/UploadPicturesMapper.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/UploadPictures.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/FileUploadedService.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/UploadPicturesService.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/FileUploadedServiceImpl.java create mode 100644 anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/UploadPicturesServiceImpl.java create mode 100644 anomaly/src/main/resources/mapper/UploadPicturesMapper.xml diff --git a/anomaly/pom.xml b/anomaly/pom.xml index 061f313a..1796024e 100644 --- a/anomaly/pom.xml +++ b/anomaly/pom.xml @@ -71,5 +71,10 @@ org.springframework spring-web + + commons-net + commons-net + 3.1 + \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java index 4311eb88..093937dd 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/AbnormalBillController.java @@ -6,6 +6,7 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; import com.foreverwin.mesnac.anomaly.service.AbnormalBillService; +import com.foreverwin.mesnac.anomaly.service.FileUploadedService; import com.foreverwin.mesnac.common.dto.SfcDispatchDto; import com.foreverwin.mesnac.common.service.SfcDispatchCommonService; import com.foreverwin.modular.core.util.FrontPage; @@ -13,6 +14,8 @@ import com.foreverwin.modular.core.util.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.util.List; /** @@ -30,6 +33,10 @@ public class AbnormalBillController { @Autowired private SfcDispatchCommonService sfcDispatchCommonService; + @Autowired + private FileUploadedService fileUploadedService; + + /** * 根据id查询 @@ -291,4 +298,19 @@ public class AbnormalBillController { public R findResrceBySfc(SfcDispatchDto sfcDispatch){ return R.ok(sfcDispatchCommonService.findResrceBySfc(sfcDispatch)); } + + @GetMapping("/show") + public R showFile(HttpServletRequest request, HttpServletResponse response) throws Exception { + return R.ok(fileUploadedService.showFile(request,response)); + } + + @PostMapping("/delete") + public R delete(String ftpPath,String fileName){ + return R.ok(fileUploadedService.deleteFile(ftpPath,fileName)); + } + + @GetMapping("/findUploadPictureByAbnormalBo") + public R findUploadPictureByAbnormalBo(AbnormalBill abnormalBill){ + return R.ok(abnormalBillService.findUploadPictureByAbnormalBo(abnormalBill)); + } } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/UploadPicturesController.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/UploadPicturesController.java new file mode 100644 index 00000000..4eddbb96 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/controller/UploadPicturesController.java @@ -0,0 +1,124 @@ +package com.foreverwin.mesnac.anomaly.controller; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.anomaly.model.UploadPictures; +import com.foreverwin.mesnac.anomaly.service.UploadPicturesService; +import com.foreverwin.modular.core.util.FrontPage; +import com.foreverwin.modular.core.util.R; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * + * @author Leon.L + * @since 2021-07-11 + */ +@RestController +@RequestMapping("/Z-UPLOAD-PICTURES") +public class UploadPicturesController { + + @Autowired + public UploadPicturesService uploadPicturesService; + + /** + * 根据id查询 + * + * @param id 主键 + * @return + */ + @ResponseBody + @GetMapping("/{id:.+}") + public R getUploadPicturesById(@PathVariable String id) { + return R.ok( uploadPicturesService.getById(id)); + } + + /** + * 查询所有数据 + * + * @return + */ + @ResponseBody + @GetMapping("") + public R getUploadPicturesList(UploadPictures uploadPictures){ + List result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(uploadPictures); + result = uploadPicturesService.list(queryWrapper); + return R.ok(result); + } + + /** + * 分页查询数据 + * + * @param frontPage 分页信息 + * @return + */ + @ResponseBody + @GetMapping("/page") + public R page(FrontPage frontPage, UploadPictures uploadPictures){ + IPage result; + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(uploadPictures); + if (frontPage.getGlobalQuery() != null && !"".equals(frontPage.getGlobalQuery().trim())) { + //TODO modify global query + queryWrapper.lambda().and(wrapper -> wrapper + .like(UploadPictures::getHandle, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getSite, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getPicturePath, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getPictureAddress, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getObjectBo, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getNum, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getType, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getCreatedUser, frontPage.getGlobalQuery()) + .or().like(UploadPictures::getModifiedUser, frontPage.getGlobalQuery()) + ); + } + result = uploadPicturesService.page(frontPage.getPagePlus(), queryWrapper); + return R.ok(result); + } + + /** + * 新增 + * @param uploadPictures 传递的实体 + * @return null 失败 实体成功 + */ + @PostMapping + public R save(@RequestBody UploadPictures uploadPictures) { + return R.ok(uploadPicturesService.save(uploadPictures)); + } + + /** + * 修改 + * @param uploadPictures 传递的实体 + * @return null 失败 实体成功 + */ + @PutMapping + public R updateById(@RequestBody UploadPictures uploadPictures) { + return R.ok(uploadPicturesService.updateById(uploadPictures)); + } + + /** + * 根据id删除对象 + * @param id 实体ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.DELETE, value = "/{id:.+}") + public R removeById(@PathVariable("id") String id){ + return R.ok(uploadPicturesService.removeById(id)); + } + + /** + * 批量删除对象 + * @param ids 实体集合ID + * @return 0 失败 1 成功 + */ + @ResponseBody + @RequestMapping(method = RequestMethod.POST, value = "/delete-batch") + public R removeByIds(List ids){ + return R.ok(uploadPicturesService.removeByIds(ids)); + } +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/UploadPicturesMapper.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/UploadPicturesMapper.java new file mode 100644 index 00000000..d4fe2ba7 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/mapper/UploadPicturesMapper.java @@ -0,0 +1,18 @@ +package com.foreverwin.mesnac.anomaly.mapper; + +import com.foreverwin.mesnac.anomaly.model.UploadPictures; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * Mapper 接口 + *

+ * + * @author Leon.L + * @since 2021-07-11 + */ +@Repository +public interface UploadPicturesMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java index b0ab7eac..148aaa4b 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/AbnormalBill.java @@ -200,6 +200,14 @@ public class AbnormalBill extends Model { @TableField("MODIFIED_DATE_TIME") private LocalDateTime modifiedDateTime; + @TableField(exist = false) + private String filePath; + + @TableField(exist = false) + private String fileName; + + @TableField(exist = false) + private String fileNum; public String getHandle() { return handle; @@ -481,7 +489,31 @@ public class AbnormalBill extends Model { this.modifiedDateTime = modifiedDateTime; } -public static final String HANDLE = "HANDLE"; + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileNum() { + return fileNum; + } + + public void setFileNum(String fileNum) { + this.fileNum = fileNum; + } + + public static final String HANDLE = "HANDLE"; public static final String SITE = "SITE"; diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/UploadPictures.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/UploadPictures.java new file mode 100644 index 00000000..a445753f --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/model/UploadPictures.java @@ -0,0 +1,216 @@ +package com.foreverwin.mesnac.anomaly.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; + +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + *

+ * + *

+ * + * @author Leon.L + * @since 2021-07-11 + */ + +@TableName("Z_UPLOAD_PICTURES") + +public class UploadPictures extends Model { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "HANDLE", type = IdType.INPUT) + private String handle; + /** + * 站点 + */ + @TableField("SITE") + private String site; + /** + * 图片路径 + */ + @TableField("PICTURE_PATH") + private String picturePath; + /** + * 图片路径详细地址 + */ + @TableField("PICTURE_ADDRESS") + private String pictureAddress; + /** + * 单号 + */ + @TableField("OBJECT_BO") + private String objectBo; + /** + * 数量 + */ + @TableField("NUM") + private String num; + /** + * 类型 + */ + @TableField("TYPE") + private String type; + /** + * 创建人 + */ + @TableField("CREATED_USER") + private String createdUser; + /** + * 创建时间 + */ + @TableField("CREATED_DATE_TIME") + private LocalDateTime createdDateTime; + /** + * 修改人 + */ + @TableField("MODIFIED_USER") + private String modifiedUser; + /** + * 修改日期 + */ + @TableField("MODIFIED_DATE_TIME") + private LocalDateTime modifiedDateTime; + + + public String getHandle() { + return handle; + } + + public void setHandle(String handle) { + this.handle = handle; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getPicturePath() { + return picturePath; + } + + public void setPicturePath(String picturePath) { + this.picturePath = picturePath; + } + + public String getPictureAddress() { + return pictureAddress; + } + + public void setPictureAddress(String pictureAddress) { + this.pictureAddress = pictureAddress; + } + + public String getObjectBo() { + return objectBo; + } + + public void setObjectBo(String objectBo) { + this.objectBo = objectBo; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCreatedUser() { + return createdUser; + } + + public void setCreatedUser(String createdUser) { + this.createdUser = createdUser; + } + + public LocalDateTime getCreatedDateTime() { + return createdDateTime; + } + + public void setCreatedDateTime(LocalDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + } + + public String getModifiedUser() { + return modifiedUser; + } + + public void setModifiedUser(String modifiedUser) { + this.modifiedUser = modifiedUser; + } + + public LocalDateTime getModifiedDateTime() { + return modifiedDateTime; + } + + public void setModifiedDateTime(LocalDateTime modifiedDateTime) { + this.modifiedDateTime = modifiedDateTime; + } + +public static final String HANDLE = "HANDLE"; + +public static final String SITE = "SITE"; + +public static final String PICTURE_PATH = "PICTURE_PATH"; + +public static final String PICTURE_ADDRESS = "PICTURE_ADDRESS"; + +public static final String OBJECT_BO = "OBJECT_BO"; + +public static final String NUM = "NUM"; + +public static final String TYPE = "TYPE"; + +public static final String CREATED_USER = "CREATED_USER"; + +public static final String CREATED_DATE_TIME = "CREATED_DATE_TIME"; + +public static final String MODIFIED_USER = "MODIFIED_USER"; + +public static final String MODIFIED_DATE_TIME = "MODIFIED_DATE_TIME"; + + + @Override + protected Serializable pkVal() { + return this.handle; + } + + @Override + public String toString() { + return "UploadPictures{" + + "handle = " + handle + + ", site = " + site + + ", picturePath = " + picturePath + + ", pictureAddress = " + pictureAddress + + ", objectBo = " + objectBo + + ", num = " + num + + ", type = " + type + + ", createdUser = " + createdUser + + ", createdDateTime = " + createdDateTime + + ", modifiedUser = " + modifiedUser + + ", modifiedDateTime = " + modifiedDateTime + + "}"; + } +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java index 93fe07d4..f47fc8f9 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/AbnormalBillService.java @@ -6,6 +6,7 @@ import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDisposeDto; import com.foreverwin.mesnac.anomaly.dto.AbnormalBillDto; import com.foreverwin.mesnac.anomaly.model.AbnormalBill; import com.foreverwin.mesnac.anomaly.model.AbnormalBillDispose; +import com.foreverwin.mesnac.anomaly.model.UploadPictures; import com.foreverwin.modular.core.util.FrontPage; import java.util.HashMap; @@ -46,7 +47,7 @@ public interface AbnormalBillService extends IService { * @param abnormalBill * @param abnormalBillDispose */ - void generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType); + String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType); void cancelBrowse(String handle,String cancelBrowse,String code); @@ -98,4 +99,17 @@ public interface AbnormalBillService extends IService { */ void anomalyShutDown(AbnormalBill abnormalBill,AbnormalBillDispose abnormalBillDispose); + /** + * 放置图片 + * @param abnormalBill + */ + public void fileUpload(AbnormalBill abnormalBill); + + /** + * 查看照片 + * @param abnormalBill + * @return + */ + public UploadPictures findUploadPictureByAbnormalBo(AbnormalBill abnormalBill); + } \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/FileUploadedService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/FileUploadedService.java new file mode 100644 index 00000000..62d0cd53 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/FileUploadedService.java @@ -0,0 +1,22 @@ +package com.foreverwin.mesnac.anomaly.service; + +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * @Description TODO + * @Author zhaojiawei + * @Since 2021-07-11 + */ +public interface FileUploadedService { + + public void uploadAttachment(MultipartFile fileItem, String site, String taskNo, String fileType); + + public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception ; + + public boolean deleteFile(String pathname, String filename); + + +} diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/UploadPicturesService.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/UploadPicturesService.java new file mode 100644 index 00000000..49b343ec --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/UploadPicturesService.java @@ -0,0 +1,28 @@ +package com.foreverwin.mesnac.anomaly.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.anomaly.model.UploadPictures; +import com.baomidou.mybatisplus.extension.service.IService; +import com.foreverwin.modular.core.util.FrontPage; + +import java.util.List; + +/** + *

+ * 服务类 + *

+ * + * @author Leon.L + * @since 2021-07-11 + */ +public interface UploadPicturesService extends IService { + + /** + * 分页查询 + * @param frontPage + * @return + */ + IPage selectPage(FrontPage frontPage, UploadPictures uploadPictures); + + List selectList(UploadPictures uploadPictures); +} \ No newline at end of file diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java index 125e4ef8..a3533e55 100644 --- a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/AbnormalBillServiceImpl.java @@ -89,6 +89,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl dutyCauseType, List dutyType) { - this.generateAbnormalBill(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); + String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, dutyCauseType, dutyType); this.saveOrUpdate(abnormalBill); abnormalBillDisposeService.saveOrUpdate(abnormalBillDispose); - return abnormalBill.getAbnormalNo(); + return message; } @Override @@ -122,7 +125,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl ncGroupAndNcCodes, List dutyCauseType, List dutyType) { - this.generateAbnormalBill(abnormalBill,abnormalBillDispose,dutyCauseType,dutyType); + String message = this.generateAbnormalBill(abnormalBill, abnormalBillDispose, dutyCauseType, dutyType); //获取当前时间 LocalDateTime now = LocalDateTime.now(); //生成不良代码和不良代码组,并把它放到hashMap里面,ncCode是存放在异常单里面的ncCode @@ -167,13 +170,13 @@ public class AbnormalBillServiceImpl extends ServiceImpl ncByNG = ncCodeService.findNcByNG(abnormalBill.getMessageType(), abnormalBill.getNcCode()); if(ncByNG == null || ncByNG.size() <= 0){ @@ -181,7 +184,7 @@ public class AbnormalBillServiceImpl extends ServiceImpl dutyCauseType,List dutyType) { + public String generateAbnormalBill(AbnormalBill abnormalBill, AbnormalBillDispose abnormalBillDispose,List dutyCauseType,List dutyType) { String site = CommonMethods.getSite(); + String message = null; LocalDateTime currentTime = LocalDateTime.now(); String user = CommonMethods.getUser(); - if(StringUtil.isBlank(abnormalBill.getAbnormalNo())){ + if(StringUtil.isBlank(abnormalBill.getAbnormalNo())) { throw BusinessException.build("异常单号不存在"); - } - - - abnormalBill.setHandle(HandleEnum.Z_ABNORMAL_BILL.getHandle(site,abnormalBill.getAbnormalNo())); //更新的时候,判断该异常当的状态是否为新建 AbnormalBill abnormalBill1 = abnormalBillMapper.selectById(abnormalBill.getHandle()); @@ -395,6 +395,9 @@ public class AbnormalBillServiceImpl extends ServiceImpl 0){ abnormalCauseService.saveOrUpdateBatch(causeTypes); } + //放置图片 + this.fileUpload(abnormalBill); + + return message; } @@ -518,4 +525,57 @@ public class AbnormalBillServiceImpl extends ServiceImpl name = null; + if(StringUtil.notBlank(abnormalBill.getFileName())){ + name = Arrays.asList(abnormalBill.getFileName().split(",")); + } + if(name != null && name.size() != 0){ + //String uuid = UUID.randomUUID().toString(); + UploadPictures uploadPictures = new UploadPictures(); + uploadPictures.setHandle("UploadPicturesBO:"+abnormalBill.getSite()+","+abnormalBill.getAbnormalNo()); + uploadPictures.setSite(abnormalBill.getSite()); + uploadPictures.setPicturePath(abnormalBill.getFilePath()); + StringBuilder pictureAddress = new StringBuilder(); + for (int i = 0; i <= name.size() -1; i++) { + if(i != name.size() -1){ + pictureAddress.append(abnormalBill.getFilePath()).append("/").append(name.get(i)).append(","); + }else{ + pictureAddress.append(abnormalBill.getFilePath()).append("/").append(name.get(i)); + } + } + uploadPictures.setPictureAddress(pictureAddress.toString()); + uploadPictures.setObjectBo(abnormalBill.getHandle()); + uploadPictures.setNum(abnormalBill.getFileNum()); + uploadPictures.setType("ABNORMAL"); + uploadPictures.setCreatedUser(user); + uploadPictures.setCreatedDateTime(now); + uploadPictures.setModifiedUser(user); + uploadPictures.setModifiedDateTime(now); + uploadPicturesService.saveOrUpdate(uploadPictures); + } + } + + @Override + public UploadPictures findUploadPictureByAbnormalBo(AbnormalBill abnormalBill) { + String site = CommonMethods.getSite(); + UploadPictures uploadPictures = new UploadPictures(); + uploadPictures.setSite(site); + uploadPictures.setObjectBo(abnormalBill.getHandle()); + List uploadPictures1 = uploadPicturesService.selectList(uploadPictures); + if(uploadPictures1 != null && uploadPictures1.size() == 1){ + return uploadPictures1.get(0); + } + return null; + } +} + + + + + + diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/FileUploadedServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/FileUploadedServiceImpl.java new file mode 100644 index 00000000..a5e970f1 --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/FileUploadedServiceImpl.java @@ -0,0 +1,167 @@ +package com.foreverwin.mesnac.anomaly.service.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.extra.ftp.Ftp; +import com.foreverwin.mesnac.anomaly.service.FileUploadedService; +import com.foreverwin.modular.core.exception.BusinessException; +import com.foreverwin.modular.core.util.CommonMethods; +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPReply; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +/** + * @Description TODO + * @Author zhaojiawei + * @Since 2021-07-10 + */ +@Service("FileUploaded") +@Transactional(rollbackFor = Exception.class) +@ConditionalOnProperty( prefix = "ftp",name = {"host","port","username","password"}) +public class FileUploadedServiceImpl implements FileUploadedService { + + @Value("${ftp.host}") + private String host; + @Value("${ftp.port}") + private Integer port; + @Value("${ftp.username}") + private String username; + @Value("${ftp.password}") + private String password; + + private final static Logger logger = LoggerFactory.getLogger("FileUploadedServiceImpl"); + + /** + * 附件上传 + * + * @param fileItem + * @return + */ + @Override + public void uploadAttachment(MultipartFile fileItem,String site,String taskNo,String fileType) { + if (StrUtil.isBlank(site)) { + site = CommonMethods.getSite(); + } + //上传附件目录:年/月/日 + String path = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd"))+"/"+taskNo; + //上传附件名称 + String fileName = fileItem.getOriginalFilename(); + try { + Ftp ftp = new Ftp(host, port,username,password); + + ftp.upload(path, fileName, fileItem.getInputStream()); + ftp.close(); + } catch (IOException e) { + logger.info(e.getMessage()); + throw BusinessException.build("" + e.getMessage()); + } + + } + + public String showFile(HttpServletRequest request, HttpServletResponse response) throws Exception { + String path = request.getParameter("PATH"); +// InputStream in = null; + OutputStream out = null; + try { + String coderPath = new String(path.getBytes("ISO8859_1")); + String newPath = new String(coderPath.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING); + // + // in = ftpClient.getFtp(path); +// in = ftpClient.getFtp(newPath); + FTPClient ftpClient = new FTPClient(); + ftpClient.connect(host,port); + ftpClient.login(username,password); + if(!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())){ + ftpClient.disconnect(); + } + ftpClient.enterLocalActiveMode(); + // 设置文件类型为二进制,与ASCII有区别 + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + // 设置编码格式 + ftpClient.setControlEncoding("GBK"); + // 提取绝对地址的目录以及文件名 + path = path.replace("ftp://"+path+":"+port+"/", ""); + String dir = path.substring(0, path.lastIndexOf("/")); + String file = path.substring(path.lastIndexOf("/")+1); + // 进入文件所在目录,注意编码格式,以能够正确识别中文目录 + boolean cdStatus = ftpClient.changeWorkingDirectory(new String(dir.getBytes("GBK"), FTP.DEFAULT_CONTROL_ENCODING)); + // 检验文件是否存在 + InputStream in = ftpClient.retrieveFileStream(new String(file.getBytes("GBK"),FTP.DEFAULT_CONTROL_ENCODING)); + if(in == null || ftpClient.getReplyCode() == FTPReply.FILE_UNAVAILABLE){ + return "该文件不存在"; + } + + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int len = 0; + while( (len=in.read(buffer)) != -1 ){ + outStream.write(buffer, 0, len); + } + byte[] data = outStream.toByteArray(); + out = response.getOutputStream(); + out.write(data); + out.flush(); + }catch (Exception e){ + return "图片获取失败"+e.getMessage(); + }finally { + out.close(); +// in.close(); + } + + return "渲染图片成功"; + } + + @Override + public boolean deleteFile(String pathname, String filename){ + boolean flag = false; + FTPClient ftpClient = null; + try { + //System.out.println("开始删除文件"); + ftpClient = new FTPClient(); + ftpClient.connect(host,port); + ftpClient.login(username,password); + if(!FTPReply.isPositiveCompletion(ftpClient.getReplyCode())){ + ftpClient.disconnect(); + } + ftpClient.enterLocalActiveMode(); + // 设置文件类型为二进制,与ASCII有区别 + ftpClient.setFileType(FTP.BINARY_FILE_TYPE); + // 设置编码格式 + ftpClient.setControlEncoding("GBK"); + //切换FTP目录 + ftpClient.changeWorkingDirectory(pathname); + ftpClient.dele(filename); + ftpClient.logout(); + flag = true; + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } finally { + if(ftpClient.isConnected()){ + try{ + ftpClient.disconnect(); + }catch(IOException e){ + e.printStackTrace(); + } + } + } + } + + +} diff --git a/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/UploadPicturesServiceImpl.java b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/UploadPicturesServiceImpl.java new file mode 100644 index 00000000..470ad05e --- /dev/null +++ b/anomaly/src/main/java/com/foreverwin/mesnac/anomaly/service/impl/UploadPicturesServiceImpl.java @@ -0,0 +1,46 @@ +package com.foreverwin.mesnac.anomaly.service.impl; + +import com.foreverwin.modular.core.util.FrontPage; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.foreverwin.mesnac.anomaly.model.UploadPictures; +import com.foreverwin.mesnac.anomaly.mapper.UploadPicturesMapper; +import com.foreverwin.mesnac.anomaly.service.UploadPicturesService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +/** + *

+ * 服务实现类 + *

+ * + * @author Leon.L + * @since 2021-07-11 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class UploadPicturesServiceImpl extends ServiceImpl implements UploadPicturesService { + + + @Autowired + private UploadPicturesMapper uploadPicturesMapper; + + @Override + public IPage selectPage(FrontPage frontPage, UploadPictures uploadPictures) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(uploadPictures); + return super.page(frontPage.getPagePlus(), queryWrapper); + } + + @Override + public List selectList(UploadPictures uploadPictures) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.setEntity(uploadPictures); + return super.list(queryWrapper); + } + + +} \ No newline at end of file diff --git a/anomaly/src/main/resources/mapper/UploadPicturesMapper.xml b/anomaly/src/main/resources/mapper/UploadPicturesMapper.xml new file mode 100644 index 00000000..2aee9399 --- /dev/null +++ b/anomaly/src/main/resources/mapper/UploadPicturesMapper.xml @@ -0,0 +1,418 @@ + + + + + + + + + + + + + + + + + + + + + + HANDLE, SITE, PICTURE_PATH, PICTURE_ADDRESS, OBJECT_BO, NUM, TYPE, CREATED_USER, CREATED_DATE_TIME, MODIFIED_USER, MODIFIED_DATE_TIME + + + + + + + + + + + + + + + + + + + + + + + + + INSERT INTO Z_UPLOAD_PICTURES + + HANDLE, + SITE, + PICTURE_PATH, + PICTURE_ADDRESS, + OBJECT_BO, + NUM, + TYPE, + CREATED_USER, + CREATED_DATE_TIME, + MODIFIED_USER, + MODIFIED_DATE_TIME, + VALUES + + #{handle}, + #{site}, + #{picturePath}, + #{pictureAddress}, + #{objectBo}, + #{num}, + #{type}, + #{createdUser}, + #{createdDateTime}, + #{modifiedUser}, + #{modifiedDateTime}, + + + + + INSERT INTO Z_UPLOAD_PICTURES + + + VALUES + + #{handle}, + #{site}, + #{picturePath}, + #{pictureAddress}, + #{objectBo}, + #{num}, + #{type}, + #{createdUser}, + #{createdDateTime}, + #{modifiedUser}, + #{modifiedDateTime}, + + + + + + UPDATE Z_UPLOAD_PICTURES + SITE=#{et.site}, + PICTURE_PATH=#{et.picturePath}, + PICTURE_ADDRESS=#{et.pictureAddress}, + OBJECT_BO=#{et.objectBo}, + NUM=#{et.num}, + TYPE=#{et.type}, + CREATED_USER=#{et.createdUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_USER=#{et.modifiedUser}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_UPLOAD_PICTURES + SITE=#{et.site}, + PICTURE_PATH=#{et.picturePath}, + PICTURE_ADDRESS=#{et.pictureAddress}, + OBJECT_BO=#{et.objectBo}, + NUM=#{et.num}, + TYPE=#{et.type}, + CREATED_USER=#{et.createdUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_USER=#{et.modifiedUser}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + WHERE HANDLE=#{et.handle} and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL} + + + + + UPDATE Z_UPLOAD_PICTURES + SITE=#{et.site}, + PICTURE_PATH=#{et.picturePath}, + PICTURE_ADDRESS=#{et.pictureAddress}, + OBJECT_BO=#{et.objectBo}, + NUM=#{et.num}, + TYPE=#{et.type}, + CREATED_USER=#{et.createdUser}, + CREATED_DATE_TIME=#{et.createdDateTime}, + MODIFIED_USER=#{et.modifiedUser}, + MODIFIED_DATE_TIME=#{et.modifiedDateTime}, + + + + + HANDLE=#{ew.entity.handle} + AND SITE=#{ew.entity.site} + AND PICTURE_PATH=#{ew.entity.picturePath} + AND PICTURE_ADDRESS=#{ew.entity.pictureAddress} + AND OBJECT_BO=#{ew.entity.objectBo} + AND NUM=#{ew.entity.num} + AND TYPE=#{ew.entity.type} + AND CREATED_USER=#{ew.entity.createdUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_USER=#{ew.entity.modifiedUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_UPLOAD_PICTURES WHERE HANDLE=#{handle} + + + + DELETE FROM Z_UPLOAD_PICTURES + + + + + ${k} = #{cm[${k}]} + + + + + + + + DELETE FROM Z_UPLOAD_PICTURES + + + + + HANDLE=#{ew.entity.handle} + + AND SITE=#{ew.entity.site} + AND PICTURE_PATH=#{ew.entity.picturePath} + AND PICTURE_ADDRESS=#{ew.entity.pictureAddress} + AND OBJECT_BO=#{ew.entity.objectBo} + AND NUM=#{ew.entity.num} + AND TYPE=#{ew.entity.type} + AND CREATED_USER=#{ew.entity.createdUser} + AND CREATED_DATE_TIME=#{ew.entity.createdDateTime} + AND MODIFIED_USER=#{ew.entity.modifiedUser} + AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime} + + + ${ew.sqlSegment} + + + + + ${ew.sqlSegment} + + + + + DELETE FROM Z_UPLOAD_PICTURES WHERE HANDLE IN ( + #{item} + ) + + + + diff --git a/console/src/main/resources/application-local.yml b/console/src/main/resources/application-local.yml index 756104aa..7d58d3c6 100644 --- a/console/src/main/resources/application-local.yml +++ b/console/src/main/resources/application-local.yml @@ -47,8 +47,15 @@ wechat: postUrl: https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN #ftp文档服务器 +#ftp: +# host: 10.4.1.53 +# port: 21 +# username: +# password: + ftp: - host: 10.4.1.53 - port: 21 - username: - password: + host: 106.52.244.124 + port: 21 + username: zjw + password: zhaojiawei + diff --git a/pom.xml b/pom.xml index abc37b8d..b3841d93 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,12 @@ + + commons-net + commons-net + 3.1 + + org.springframework.boot spring-boot-starter-tomcat