104 lines
3.8 KiB
C#
104 lines
3.8 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
|
|
using Kingdee.BOS.Core.Bill.PlugIn;
|
|
|
|
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
|
|
|
|
using Kingdee.BOS.ServiceHelper;
|
|
|
|
|
|
namespace aoyuPlugIn
|
|
{
|
|
[Description("注塑日工资")]
|
|
public class zs_rgz : AbstractBillPlugIn
|
|
{
|
|
|
|
//单据头菜单点击
|
|
public override void BarItemClick(BarItemClickEventArgs e)
|
|
{
|
|
base.BarItemClick(e);
|
|
string t = Convert.ToDateTime(this.View.Model.GetValue("FDate").ToString()).ToShortDateString();
|
|
if (e.BarItemKey == "tbSCRGZ")
|
|
{
|
|
check_data(t);
|
|
}
|
|
}
|
|
//检测数据是否有未审核
|
|
void check_data(string date1)
|
|
{
|
|
try
|
|
{
|
|
date1 = "'" + date1 + "'";
|
|
var sSql = String.Format("EXEC hw_zsrgz_checkSH " + date1);
|
|
var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
|
|
if (dr.Count > 0)
|
|
{
|
|
string t = dr[0][0].ToString();
|
|
this.View.ShowMessage(t);
|
|
return;
|
|
}
|
|
add_data_stort(date1);
|
|
}
|
|
catch (Exception ex)
|
|
{ this.View.ShowMessage("检测数据是否有未审核时发生错误为:" + ex.Message); }
|
|
|
|
}
|
|
//存储过程加入表
|
|
public void add_data_stort(string cs)
|
|
{
|
|
try
|
|
{
|
|
del_data("F_QBOY_Entity");//先删除数据
|
|
//return;
|
|
//cs = "'" + cs + "'";
|
|
var sSql = String.Format("EXEC hw_get_rgz_zs " + cs);
|
|
var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
|
|
int i = 0;
|
|
if (dr.Count > 0)
|
|
{
|
|
this.View.Model.BatchCreateNewEntryRow("F_QBOY_Entity", dr.Count);
|
|
}
|
|
foreach (var item in dr)
|
|
{
|
|
|
|
this.Model.SetValue("FYGID", item[0], i);
|
|
this.Model.SetValue("FJJGZ", item[1], i);
|
|
this.Model.SetValue("FJSGZ", item[2], i);
|
|
this.Model.SetValue("FTJBT", item[3], i);
|
|
this.Model.SetValue("FBMJT", item[4], i);
|
|
this.Model.SetValue("FYBBT", item[5], i);
|
|
this.Model.SetValue("FCFBT", item[6], i);
|
|
this.Model.SetValue("FKJBT", item[7], i);
|
|
this.Model.SetValue("FOTHER", item[8], i);
|
|
this.Model.SetValue("FDTGZ", item[9], i);
|
|
//this.Model.SetValue("F_GWBT", item[10], i);
|
|
//this.Model.SetValue("F_CFBT", item[11], i);
|
|
//this.Model.SetValue("F_YBBT", item[12], i);
|
|
//this.Model.SetValue("F_XYGBT", item[13], i);
|
|
//this.Model.SetValue("F_SYQBT", item[14], i);
|
|
//this.Model.SetValue("F_XCPBT", item[15], i);
|
|
i++;
|
|
}
|
|
}
|
|
catch (Exception ex) { this.View.ShowMessage("加表体数据时发生错误为:" + ex.Message); }
|
|
}
|
|
//计算前先删除当前数据
|
|
void del_data(string FEntity_nm)
|
|
{
|
|
try
|
|
{
|
|
//取表体最大行数
|
|
int tol = this.Model.GetEntryRowCount(FEntity_nm);
|
|
tol--;
|
|
for (int i = tol; i > -1; i--)
|
|
{
|
|
this.View.Model.DeleteEntryRow(FEntity_nm, i); //先删除空行
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{ this.View.ShowMessage("删除表体数据时发生错误为:" + ex.Message); }
|
|
}
|
|
}
|
|
}
|