生产订单删除排产校验排产日期不能小于当前日期原创
金蝶云社区-乐滋滋
乐滋滋
2人赞赏了该文章 363次浏览 未经作者许可,禁止转载编辑于2021年11月18日 15:54:01

生产订单表单插件,继承于标准产品生产订单表单插件MOEdit

using Kingdee.BOS.Core.DynamicForm.PlugIn.Args; using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel; using Kingdee.BOS.Core.Metadata.EntityElement; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Kingdee.BOS.Util; using Kingdee.BOS.Orm.DataEntity; using Kingdee.K3.Core.MFG.EntityHelper; 

namespace Kingdee.K3.MFG.PRD.Business.PlugIn.Bill 

{   

 public class EKDeleteSchedule : MOBillEdit    

   {        

        public override void EntryBarItemClick(BarItemClickEventArgs e)      

                {           

                     switch (e.BarItemKey.ToUpper())           

                 {              

                      case "TBDELETESCHEDULE":                   

                             int[] SelectedRow =         this.View.GetControl<EntryGrid(CONST_PRD_MO.CONST_FScheduledEntity.ENTITY_FScheduledEntity).GetSelectedRows();                    if (SelectedRow.Count() <= 0) return;                   

 List<DynamicObject> selectRows = new List<DynamicObject>();                    Entity entity = this.View.BusinessInfo.GetEntity(CONST_PRD_MO.CONST_FScheduledEntity.ENTITY_FScheduledEntity);                    foreach (int row in SelectedRow)                    {                        DynamicObject entryData = this.View.Model.GetEntityDataObject(entity, row);                        if (entryData.IsNullOrEmptyOrWhiteSpace()) continue;                        DateTime curDate = System.DateTime.Now.BeginDateTimeOfDay();                        DateTime scheduleStarTime = entryData.GetDynamicObjectItemValue<DateTime>(CONST_PRD_MO.CONST_FScheduledEntity.ORM_PlanStartDateD);                        if (scheduleStarTime < curDate)                        {                            e.Cancel = true;                            break;                        }                    }                    if (e.Cancel)                    {                        this.View.ShowErrMessage("存在排产日期小于当前日期的排产明细行,请重新选择");                    }                    break;            }        }    } }                

赞 2