168 lines
5.9 KiB
C#
168 lines
5.9 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;
|
||
namespace aoyuPlugIn
|
||
{
|
||
[Description("装配日工资")]
|
||
public class aoyuPlugIn : AbstractBillPlugIn
|
||
{
|
||
|
||
////菜单按钮必须有操作事件,如新增,删除、保存等
|
||
//public override void BeforeDoOperation(BeforeDoOperationEventArgs e)
|
||
//{
|
||
// base.BeforeDoOperation(e);
|
||
|
||
// //this.View.ShowMessage("菜单测试成功!");
|
||
//}
|
||
//单据头菜单点击
|
||
public override void BarItemClick(BarItemClickEventArgs e)
|
||
{
|
||
base.BarItemClick(e);
|
||
//this.View.ShowMessage("Hello World:" + e.BarItemKey.ToString());
|
||
string t = Convert.ToDateTime(this.View.Model.GetValue("FDate").ToString()).ToShortDateString();
|
||
|
||
if (e.BarItemKey == "tbSCRGZ")
|
||
{
|
||
check_data(t);
|
||
}
|
||
else if (e.BarItemKey == "tbSplitSave" || e.BarItemKey == "tbSave")//
|
||
{
|
||
//t = "'" + t + "'";
|
||
//var sSql = String.Format("EXEC hw_get_zpjjmxb " + t );
|
||
//var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
|
||
}
|
||
else if (e.BarItemKey == "tbSplitSubmit" || e.BarItemKey == "tbSubmit")
|
||
{
|
||
sc_mx(t);
|
||
}
|
||
}
|
||
//生成员工计件工资明细
|
||
void sc_mx(string fdate)
|
||
{
|
||
try
|
||
{
|
||
fdate = "'" + fdate + "'";
|
||
var sSql = String.Format("EXEC hw_get_zpjjmxb " + fdate);
|
||
var dr = DBServiceHelper.ExecuteDynamicObject(this.Context, sSql);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
this.View.ShowMessage("生成员工计件工资明细时发生错误为:" + ex);
|
||
}
|
||
}
|
||
////单据体菜单操作
|
||
//public override void EntryBarItemClick(BarItemClickEventArgs e)
|
||
//{
|
||
// base.EntryBarItemClick(e);
|
||
//}
|
||
//按钮事件
|
||
public override void ButtonClick(ButtonClickEventArgs e)
|
||
{
|
||
base.ButtonClick(e);
|
||
try
|
||
{
|
||
if (e.Key == "F_GAT_BUTTON")
|
||
{
|
||
|
||
string t = Convert.ToDateTime(this.View.Model.GetValue("FDate").ToString()).ToShortDateString();
|
||
//add_data_stort(t);
|
||
//check_data(t);
|
||
//this.View.ShowMessage(t);
|
||
|
||
}
|
||
}
|
||
catch (Exception ex) { this.View.ShowMessage("取日期时发生错误为:" + ex.Message); }
|
||
|
||
}
|
||
//检测数据是否有未审核
|
||
void check_data(string date1)
|
||
{
|
||
try
|
||
{
|
||
date1 = "'" + date1 + "'";
|
||
var sSql = String.Format("EXEC hw_jsrgz_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 " + 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("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_JLGZ", item[3], i);
|
||
this.Model.SetValue("F_JBGZ", item[4], i);
|
||
this.Model.SetValue("F_CSBT", item[5], i);
|
||
this.Model.SetValue("F_GWBT", item[6], i);
|
||
this.Model.SetValue("F_XYGBT", item[7], i);
|
||
this.Model.SetValue("F_SYQBT", item[8], i);
|
||
this.Model.SetValue("F_QT", item[9], i);
|
||
this.Model.SetValue("F_DRGZ", item[10], 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); }
|
||
}
|
||
|
||
}
|
||
|
||
|
||
}
|