汇报单下推入库单包含已完工状态的生产订单
这个插件只是保证完工状态的生产订单 在生产汇报下推到生产入库单时能下推成功
后续业务流程有什么校验卡主不允许完工的生产订单不在这个插件范围内
using Kingdee.BOS.Core.Enums;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Metadata.ConvertElement.PlugIn.Args;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.K3.Core.MFG.EntityHelper;
using Kingdee.K3.Core.MFG.EnumConst;
using Kingdee.K3.MFG.PRD.App.BillConvertServicePlugIn.Validator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kingdee.K3.MFG.PRD.App.BillConvertServicePlugIn
{
public class Report2InStockItemConvertEKEK : Report2InStockItemConvert
{
protected override void OnAddPushValidators(ConvertContext e)
{
base.OnAddPushValidators(e);
string strValid = "Kingdee.K3.MFG.PRD.App.BillConvertServicePlugIn.Validator.MoSechandValidator";
var aa = e.Validators.Where(p => p.ToString() == strValid);
e.Validators.RemoveAll(x => aa.Contains(x));
e.Validators.Add(new MoSechandValidator()
{
EntityKey = Consts_PRD_MoRpt.FKEY_ENTRY,//获取单据的SelectRows对应单据的表头还是表体
OrmMoEntityId = Consts_PRD_MoRpt.ORMKEY_ENTRY_MOENTRYID,//生产订单分录内码的Key
MoStatus = new List<BOSEnums.Enu_BillStatus>() { BOSEnums.Enu_BillStatus.KdApproved },//允许的状态
MoCancelStatus = new List<BOSEnums.Enu_CancelStatus>() { BOSEnums.Enu_CancelStatus.KdNormal },//允许的作废状态
MoEntityStatus = new List<Enums.Enu_MOREQ_Status>() { Enums.Enu_MOREQ_Status.KdStart, Enums.Enu_MOREQ_Status.KdFinish },//允许的分录状态
Suspend = 0////0允许非挂起;1允许挂起,-1不做校验
});
}
/// <summary>
/// 下推、从选单界面选择行返回后
/// </summary>
/// <param name="e"></param>
public override void OnInSelectedRow(InSelectedRowEventArgs e)
{
ConvertContext cctx = new ConvertContext(e.SelectedRows);
this.OnAddPushValidators(cctx);
IEnumerable<ListSelectedRow> selectedRows = e.SelectedRows;
if (selectedRows != null && selectedRows.Count() > 0 && this.IsPush)
{
string strFilterSql = GetMoEntityFilterSql();
e.InSelectedRowsSQL = SqlAppendAnd(e.InSelectedRowsSQL, strFilterSql);
}
}
/// <summary>
/// 弹出选单界面前执行
/// </summary>
/// <param name="e"></param>
public override void OnParseFilterOptions(ParseFilterOptionsEventArgs e)
{
// base.OnParseFilterOptions(e);
string strFilterSql = GetMoEntityFilterSql();
e.FilterOptionsSQL = SqlAppendAnd(e.FilterOptionsSQL, strFilterSql);
}
/// <summary>
/// 获取过滤条件
/// </summary>
/// <returns></returns>
private string GetMoEntityFilterSql()
{
/*所选生产汇报单对应的生产订单分录:业务状态为“开工”
*所选生产汇报单对应的生产订单分录:未挂起*/
string strFilterMoEntity = string.Format(
@"SELECT V1.FENTRYID FROM T_PRD_MO M JOIN T_PRD_MOENTRY V1 ON M.FID=V1.FID JOIN T_PRD_MOENTRY_A V2 ON V1.FENTRYID = V2.FENTRYID WHERE M.FDOCUMENTSTATUS = '{0}' AND M.FCANCELSTATUS='{1}' AND V1.FISSUSPEND = {2} AND V2.FSTATUS in('{3}','{5}') AND {4} = V1.FENTRYID ",
(char)BOSEnums.Enu_BillStatus.KdApproved,//审核
(char)BOSEnums.Enu_CancelStatus.KdNormal,//正常
0,
(int)Enums.Enu_MOREQ_Status.KdStart,//开工
Consts_PRD_MoRpt.FKEY_ENTRY_MOENTRYID,
(int)Enums.Enu_MOREQ_Status.KdFinish);//完工
//数量校验配在单据转换规则上
string strFilterSql = string.Format(" (1=1) AND EXISTS ({0}) ",
strFilterMoEntity);
return strFilterSql;
}
}
}
汇报单下推入库单包含已完工状态的生产订单
本文2024-09-23 03:23:03发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-158513.html