Files
Gatedge.HuiWei.BOS.JJGZMJ/aoyuPlugIn/常成/fhtzd.cs
2025-06-20 09:17:36 +08:00

110 lines
4.3 KiB
C#

using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.Bill.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Metadata;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Core.SqlBuilder;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.ServiceHelper;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Core.Validation;
using Kingdee.BOS.Core.DynamicForm.PlugIn.ControlModel;
//using System.Windows.Forms;
//using System.Data;
namespace aoyuPlugIn
{//AbstractValidator
[Description("发货通知单")]
public class xs_fhtzd : AbstractBillPlugIn
{
List<KeyValuePair<int, string>> mycolor = new List<KeyValuePair<int, string>>();
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
if (e.BarItemKey == "tbApprove" || e.BarItemKey== "tbSplitApprove")
{
string fbillno = this.View.Model.GetValue("FBillNo").ToString();
var sSql = String.Format("EXEC hz_fhtzd " + fbillno);
var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
if (dr.Count > 0)
{
string t = "发货数量大于当前库存,不能审核!";
foreach (var item in dr)
{
string k = "物料编号:" + item["FNUMBER"].ToString() + "|未出库数合计:" + item["wcks"].ToString()
+ "|即时库存:" + item["jskc"].ToString();
t = t + "\r\n" + k;
}
List<KeyValuePair<int, string>> colors = new List<KeyValuePair<int, string>>();
DynamicObjectCollection entrys = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity("FEntity"));
int rowNo = 0;
//80C8FE
foreach (var one in entrys)
{
string wl = "";
wl = Convert.ToString((this.View.Model.GetValue("FMATERIALID", rowNo) as DynamicObject)["Number"]);
foreach (var item in dr)
{
if (item["FNUMBER"].ToString() == wl)
{ colors.Add(new KeyValuePair<int, string>(rowNo, "#80C8FE"));
mycolor.Add(new KeyValuePair<int, string>(rowNo, "#FFFFFF"));
}
}
rowNo++;
}
EntryGrid grid = this.View.GetControl<EntryGrid>("FEntity");
grid.SetRowBackcolor(colors);
this.View.ShowMessage(t);
//setColor();
e.Cancel = true;
}
}
}
public override void EntryBarItemClick(BarItemClickEventArgs e)
{
base.EntryBarItemClick(e);
if(e.BarItemKey.ToString()== "tbDeleteRow")
{
EntryGrid grid = this.View.GetControl<EntryGrid>("FEntity");
//int tol = this.Model.GetEntryRowCount("FEntity");
int k=this.Model.GetEntryCurrentRowIndex("FEntity");
grid.SetRowBackcolor("#FFFFFF", k);
}
//this.View.ShowMessage(e.BarItemKey.ToString());
}
//设置行颜色
void setColor()
{
List<KeyValuePair<int, string>> colors = new List<KeyValuePair<int, string>>();
DynamicObjectCollection entrys = this.View.Model.GetEntityDataObject(this.View.BusinessInfo.GetEntity("FEntity"));
int rowNo = 0;
foreach(var one in entrys)
{
colors.Add(new KeyValuePair<int, string>(rowNo, "#80C8FE"));
rowNo++;
}
EntryGrid grid = this.View.GetControl<EntryGrid>("FEntity");
grid.SetRowBackcolor(colors);
}
}
}