Files
Gatedge.HuiWei.BOS.JJGZMJ/aoyuPlugIn/汇威/zp_ygz.cs

173 lines
6.5 KiB
C#
Raw Normal View History

2025-06-20 09:17:36 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
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;
namespace aoyuPlugIn
{
[Description("装配月工资")]
public class zp_ygz : AbstractBillPlugIn
{
public override void BarItemClick(BarItemClickEventArgs e)
{
base.BarItemClick(e);
//this.View.ShowMessage("Hello World" + e.BarItemKey.ToString());
if (e.BarItemKey == "tbSCYGZ")
{
string years = this.View.Model.GetValue("F_YEAR").ToString();
if (years == "" || years == "0") years = DateTime.Today.Year.ToString();
string months = this.View.Model.GetValue("F_MONTH").ToString();
del_data("F_YGZ_ZP", years, months);
}
}
//删除窗体数据
void del_data(string bodynm, string y, string m)
{
try
{
//取表体最大行数
int tol = this.Model.GetEntryRowCount(bodynm);
tol--;
for (int i = tol; i > -1; i--)
{
this.View.Model.DeleteEntryRow(bodynm, i); //先删除空行
}
add_data_stort(y, m, bodynm);
}
catch (Exception ex)
{ this.View.ShowMessage("删除表体数据时发生错误为:" + ex.Message); }
}
//加载数据
void add_data_stort(string y, string m, string bodynm)
{
try
{
string cs = y + "," + m;
var sSql = String.Format("EXEC hw_get_ygz " + cs);
var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
int i = 0;
if (dr.Count > 0)
{
string t = dr[0][0].ToString();
if (t == "1")
{
this.View.ShowMessage("计算月工资失败:因为日工资有未审核单据");
return;
}
this.View.Model.BatchCreateNewEntryRow(bodynm, dr.Count);
}
foreach (var item in dr)
{
this.Model.SetValue("F_YGNO", item[0], i);
this.Model.SetValue("F_JJGZ", item[1], i);
this.Model.SetValue("F_JSGZ", item[2], i);
this.Model.SetValue("F_BZGZ", item[3], i);
this.Model.SetValue("F_JLGZ", item[4], i);
this.Model.SetValue("F_YCGZ", item[5], i);
this.Model.SetValue("F_JBGZ", item[6], i);
this.Model.SetValue("F_QT", item[7], i);
this.Model.SetValue("F_CSBT", item[8], i);
this.Model.SetValue("F_GWBT", item[9], i);
this.Model.SetValue("F_CFBT", item[10], i);
this.Model.SetValue("F_YBBT", item[11], i);
this.Model.SetValue("F_XYGBT", item[12], i);
this.Model.SetValue("F_SYQBT", item[13], i);
this.Model.SetValue("F_XCPBT", item[14], i);
this.Model.SetValue("F_DRGZ", item[15], i);
this.Model.SetValue("F_GLBT", item[16], i);
i++;
}
}
catch (Exception ex) { this.View.ShowMessage("加表体数据时发生错误为:" + ex.Message); }
}
//显示明细
//单据体菜单操作
public override void EntryBarItemClick(BarItemClickEventArgs e)
{
base.EntryBarItemClick(e);
//DynamicFormShowParameter param = new DynamicFormShowParameter();
//param.FormId = BusinessObjectConst.HS_Hook_StockArticulation; //动态表单唯一标识,由字符串组成
//param.OpenStyle.ShowType = ShowType.Default;
//this.View.ShowForm(param);
if (e.BarItemKey == "tbShowMX")
{
//F_GAT_BaseProperty员工姓名
string djtnm = "yggzmx";
//try
//{
// int index = this.View.Model.GetEntryCurrentRowIndex(djtnm);
// DynamicObject obj = this.Model.DataObject;
// DynamicObjectCollection rows = obj[djtnm] as DynamicObjectCollection;
// string tt = rows[index]["F_YGNO"].ToString();
// this.View.ShowMessage("当前行员工编号为:" + tt);
//}
//catch(Exception ex) { this.View.ShowMessage(ex.Message); }
DynamicFormShowParameter param = new DynamicFormShowParameter();
string fgtid = "121";
//param.CustomParams.Add("mid", "0");
//param.CustomParams.Add("gid", Convert.ToString(fgtid));
param.FormId = "k5c2439c690654f63b158713af5fe353e";
this.View.ShowForm(param);
}
}
public override void EntityRowDoubleClick(EntityRowClickEventArgs e)
{
base.EntityRowDoubleClick(e);
int i = e.Row;
string Y = this.View.Model.GetValue("F_YEAR").ToString();
string M = this.View.Model.GetValue("F_MONTH").ToString();
Int64 ID = Convert.ToInt64((this.View.Model.GetValue("F_YGNO", i) as DynamicObject)["ID"]);
//this.View.ShowMessage(ID.ToString());
//DynamicFormShowParameter param = new DynamicFormShowParameter();
Kingdee.BOS.Core.DynamicForm.DynamicFormShowParameter param =
new Kingdee.BOS.Core.DynamicForm.DynamicFormShowParameter();
//string fgtid = "121";
//param.CustomParams.Add("mid", "0");
//param.CustomParams.Add("ygid", Convert.ToString(ID));
//param.CustomParams.Add("FYEAR",Y);
//param.CustomParams.Add("FMONTH", M);
//param.CustomParams.Add("FDAY", "");
//param.FormId = "k5c2439c690654f63b158713af5fe353e";
param.FormId = "BOS_K3Displyer";
this.View.ShowForm(param);
}
}
}