生产订单表单插件,继承于标准产品生产订单表单插件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; } } } }
推荐阅读