From 0b2487117df3c7ac49128c6f803afb5a35daf5e9 Mon Sep 17 00:00:00 2001 From: mzr Date: Thu, 30 Oct 2025 10:19:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(ic):=E4=BC=98=E5=8C=96=E6=97=A0?= =?UTF-8?q?=E5=A4=87=E6=96=99=E9=A2=86=E6=96=99-=E5=8F=91=E6=96=99?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E7=89=88=E6=9C=ACid=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=AD=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rule/NoItemsDeliverMaterialRule.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/ic/src/private/nc/bs/ic/m45/insert/rule/NoItemsDeliverMaterialRule.java b/ic/src/private/nc/bs/ic/m45/insert/rule/NoItemsDeliverMaterialRule.java index 0ca7ea2f..ae306b61 100644 --- a/ic/src/private/nc/bs/ic/m45/insert/rule/NoItemsDeliverMaterialRule.java +++ b/ic/src/private/nc/bs/ic/m45/insert/rule/NoItemsDeliverMaterialRule.java @@ -42,6 +42,7 @@ import nc.vo.pub.lang.UFDate; import nc.vo.pub.lang.UFDouble; import nc.vo.pubapp.pattern.exception.ExceptionUtils; import nc.vo.pubapp.pattern.pub.SqlBuilder; +import nc.vo.vorg.StockOrgVersionVO; import java.util.ArrayList; import java.util.List; @@ -79,9 +80,12 @@ public class NoItemsDeliverMaterialRule implements IRule { } private void noItemsDeliverMaterial(PurchaseInVO[] inVOS) throws BusinessException { - String OrgCondition = "code = 'C038' and enablestate = '2' and isbusinessunit='Y'"; + String orgCondition = "code = 'C038' and enablestate = '2' and isbusinessunit='Y'"; HYPubBO hyPub = new HYPubBO(); - String orgId = hyPub.findColValue(OrgVO.getDefaultTableName(), OrgVO.PK_ORG, OrgCondition) + ""; + String orgId = hyPub.findColValue(OrgVO.getDefaultTableName(), OrgVO.PK_ORG, orgCondition) + ""; + // 组织版本id + orgCondition = "code = 'C038' and enablestate = '2'"; + String org_vid = hyPub.findColValue(StockOrgVersionVO.getDefaultTableName(), StockOrgVersionVO.PK_VID, orgCondition) + ""; // 精密铸造,生成采购入库成功后再进行无备料领料 for (PurchaseInVO inVO : inVOS) { PurchaseInHeadVO head = inVO.getHead(); @@ -94,6 +98,10 @@ public class NoItemsDeliverMaterialRule implements IRule { if (configParams.isEmpty()) { ExceptionUtils.wrappBusinessException("自定义档案中的jm-config参数未配置"); } + String warehouseId = getWarehouseInfo(pkOrg, configParams); + if (MMValueCheck.isEmpty(warehouseId) || "~".equals(warehouseId)) { + ExceptionUtils.wrappBusinessException("请检查仓库编码是否配置正确"); + } for (PurchaseInBodyVO body : bodys) { String cmaterialvid = body.getCmaterialvid(); String condition = "pk_material = '" + cmaterialvid + "'"; @@ -172,10 +180,7 @@ public class NoItemsDeliverMaterialRule implements IRule { PickmHeadVO pickmHeadVO = pickmVO.getParentVO(); String cpickmid = pickmHeadVO.getCpickmid(); List itemVOS = new ArrayList<>(); - String warehouseId = getWarehouseInfo(pkOrg, configParams); - if (MMValueCheck.isEmpty(warehouseId) || "~".equals(warehouseId)) { - ExceptionUtils.wrappBusinessException("请检查仓库编码是否配置正确"); - } + Map materialMap = getMaterialInfo(cmaterialvid); String pkMeasdoc = ""; if (materialMap != null) { @@ -185,8 +190,8 @@ public class NoItemsDeliverMaterialRule implements IRule { itemVO.setCpickmid(cpickmid); itemVO.setPk_group("00"); itemVO.setPk_org(pkOrg); - itemVO.setPk_org_v(pkOrg); - itemVO.setCdeliverorgvid(pkOrg);// 发料组织 + itemVO.setPk_org_v(org_vid); + itemVO.setCdeliverorgvid(org_vid);// 发料组织 itemVO.setCdeliverorgid(pkOrg);// 发料组织 itemVO.setVrowno("10");// 行号 itemVO.setCbmaterialid(cmaterialvid); From a7b4fd64cf80b914dd5fe675cf87c3dd9aeb4cf7 Mon Sep 17 00:00:00 2001 From: mzr Date: Thu, 30 Oct 2025 10:21:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(ic):=E4=BC=98=E5=8C=96=E6=97=A0?= =?UTF-8?q?=E5=A4=87=E6=96=99=E9=A2=86=E6=96=99-=E6=9D=90=E6=96=99?= =?UTF-8?q?=E5=87=BA=E5=BA=93-=E6=89=B9=E6=AC=A1=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BA=E6=A0=B9=E6=8D=AE=E4=BB=93=E5=BA=93?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../insert/rule/MaterialOutBatchCodeRule.java | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/ic/src/private/nc/bs/ic/m4d/insert/rule/MaterialOutBatchCodeRule.java b/ic/src/private/nc/bs/ic/m4d/insert/rule/MaterialOutBatchCodeRule.java index fd5ae8d5..02c1990f 100644 --- a/ic/src/private/nc/bs/ic/m4d/insert/rule/MaterialOutBatchCodeRule.java +++ b/ic/src/private/nc/bs/ic/m4d/insert/rule/MaterialOutBatchCodeRule.java @@ -1,5 +1,7 @@ package nc.bs.ic.m4d.insert.rule; +import nc.bs.dao.BaseDAO; +import nc.bs.dao.DAOException; import nc.bs.framework.common.InvocationInfoProxy; import nc.bs.framework.common.NCLocator; import nc.bs.ic.pub.base.ICRule; @@ -8,8 +10,10 @@ import nc.bs.trade.business.HYPubBO; import nc.bs.uapbd.util.MyHelper; import nc.itf.mmpac.pickm.IPickmQueryService; import nc.itf.uap.IUAPQueryBS; +import nc.jdbc.framework.processor.ColumnProcessor; import nc.util.mmf.framework.base.MMValueCheck; import nc.vo.bd.material.MaterialVO; +import nc.vo.bd.stordoc.StordocVO; import nc.vo.ic.m4d.entity.MaterialOutBodyVO; import nc.vo.ic.m4d.entity.MaterialOutHeadVO; import nc.vo.ic.m4d.entity.MaterialOutVO; @@ -36,6 +40,16 @@ public class MaterialOutBatchCodeRule extends ICRule { private static final String LOG_INFO_NAME = "jmqylog"; private static final Log logger = Log.getInstance(LOG_INFO_NAME); private Map configParams; + + public BaseDAO dao; + + public BaseDAO getDao() { + if (dao == null) { + dao = new BaseDAO(); + } + return dao; + } + private IUAPQueryBS queryBS = null; public final IUAPQueryBS getQueryBS() { @@ -64,10 +78,15 @@ public class MaterialOutBatchCodeRule extends ICRule { MaterialOutHeadVO headVO = vo.getHead(); MaterialOutBodyVO[] bodys = vo.getBodys(); String pk_org = (String) headVO.getAttributeValue("pk_org"); - String vtrantypecode = headVO.getVtrantypecode(); + String cwarehouseid = headVO.getCwarehouseid(); String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); if ("C038".equals(orgCode)) { - if ("4D-Cxx-58".equals(vtrantypecode)) { + String warehouseId = getWarehouseInfo(pk_org, configParams); + if (MMValueCheck.isEmpty(warehouseId) || "~".equals(warehouseId)) { + ExceptionUtils.wrappBusinessException("请检查仓库编码是否配置正确"); + } + // 判断仓库是否为WF001 + if (warehouseId.equals(cwarehouseid)) { IPickmQueryService service = NCLocator.getInstance().lookup(IPickmQueryService.class); // 批次号赋值 for (MaterialOutBodyVO body : bodys) { @@ -126,4 +145,18 @@ public class MaterialOutBatchCodeRule extends ICRule { return resMap; } + private String getWarehouseInfo(String pk_org, Map configParams) throws DAOException { + String warehouseCode = configParams.get("warehouseCode"); + SqlBuilder sqlBuilder = new SqlBuilder(); + sqlBuilder.append(" select " + StordocVO.PK_STORDOC); + sqlBuilder.append(" from " + StordocVO.getDefaultTableName()); + sqlBuilder.append(" where dr = 0"); + sqlBuilder.append(" and "); + sqlBuilder.append(StordocVO.CODE, warehouseCode); + sqlBuilder.append(" and "); + sqlBuilder.append(StordocVO.PK_ORG, pk_org); + String warehouseId = (String) getDao().executeQuery(sqlBuilder.toString(), new ColumnProcessor()); + return warehouseId; + } + }