批号拣货按批号模糊匹配拣货二开实现原创
金蝶云社区-邱育华
邱育华
4人赞赏了该文章 915次浏览 未经作者许可,禁止转载编辑于2022年09月16日 17:36:33

一、【业务需求】

拣货场景:下推下游单据,执行批号拣货的时候,比如上游单据指定了批号,想要实现拣货的时候可以检出所有包含上游批号字段内容的货。比如录入批号123,需要拣出所有包含123的批号,比如A123,123bcd等类似的库存


二、【功能分析】

通过批号拣货插件,实现RegexCurRowPickFilterString方法,将标准产品拼接的批号完全匹配改为模糊匹配


二开拣货插件相关文章参考:

1、批号拣货插件 

2、批号捡货二次开发插件示例 


using Kingdee.BOS.Core;
using Kingdee.K3.Core.MFG.EntityHelper;
using Kingdee.K3.SCM.App.Core.ConvertBusinessService;
using Kingdee.K3.SCM.App.Core.ConvertBusinessService.LotPickArgs;
using System;
using System.Collections.Generic;
using System.Data;

namespace Cus.Kingdee.K3.PlugIn.LotPick
{
    public class LotPickFuzzyMatchFilter : AbstractLotPickPlugIn
    {
        public override string RegexCurRowPickFilterString(RegexCurRowPickFilterStringArgs e)
        {
            // 当前行实体
            ExtendedDataEntity entity = e.Entity;
            var materialInfo = e.MatInfo;

            // 按照批号模糊匹配,前提条件:批号拣货服务,批号字段不勾选匹配,规则:上游单据指定 xxx批号,下推,模糊匹配批号库存
            string lotText = entity.DataEntity.GetDynamicValue<string>(this.PivotalField.LotKey.TrimStart('F') + "_Text");
            if (!string.IsNullOrWhiteSpace(e.FilterString))
            {
                e.FilterString += string.Format(" AND FLOT_NU like '%{0}%'", lotText);
            }

            return e.FilterString;
        }
    }
}


前提条件:批号拣货服务,批号字段不勾选匹配

image.png


上游单据:指定批号2022-05-24002

image.png

下推下游单据:模糊匹配,拣出批号:2022-05-240002、2022-05-24002-1


image.png

说明:该二开场景也可适用其他字段

比如:按照计划跟踪号匹配,规则:上游单据指定了 计划跟踪号为xxx,下推,先拣货计划跟踪号为xxx的库存,库存不足时,拣货 计划跟踪号为空的库存(前提条件:批号拣货服务,计划跟踪号字段不勾选匹配

string mtono = Convert.ToString(entity.DataEntity["Mtono"]);
if (!string.IsNullOrWhiteSpace(e.FilterString))
{
       e.FilterString += string.Format(" AND (FMTONO = '{0}' OR FMTONO = '' )", mtono);
}



以上二开仅供参考,是否能够达到业务要求有待实际账套业务数据验证! 

赞 4