using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using SQLHelper;
|
using Pub_Class;
|
|
namespace Kanban
|
{
|
public partial class Sc_WorkBillProcTimeReportKB2 : Form
|
{
|
public Sc_WorkBillProcTimeReportKB2()
|
{
|
InitializeComponent();
|
}
|
public string ViewName = "h_p_Sc_WorkBillProcTimeReportKB2";
|
public string sDeptID = "0";
|
public int iRow = 0;
|
public DateTime oBegintime = new DateTime();
|
public DateTime otimeNow = new DateTime();
|
public int oWorkTime = 0;
|
public Int64 HICMOInterID = 0;
|
DataSet DSet;
|
bool sTrue = false;
|
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
//得到当前日期 时间
|
lblTimeNow.Text = DBUtility.ClsPub.GetServerDate(-1);
|
}
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
if (sTrue == false)
|
return;
|
//计算倒计时时间
|
|
DataSet Ds;
|
SQLHelper.ClsCN oCn = new ClsCN();
|
oWorkTime = DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[iRow]["HWorkTime"]) * 60;
|
oBegintime = DBUtility.ClsPub.isDate(DSet.Tables[0].Rows[iRow]["HBeginTime"]);
|
HICMOInterID = DBUtility.ClsPub.isLong(DSet.Tables[0].Rows[iRow]["HInterID"]) ;
|
Ds = oCn.RunProcReturn("exec h_p_Sc_WorkBillProcTimeReportKB2_ByWorkTime " + sDeptID + "," + HICMOInterID + "," + oWorkTime + ",'" + oBegintime + "'", "Gy_WorkTime");
|
string sZF = "";
|
int HHour = 0;
|
int HMinute = 0;
|
int HSecond = 0;
|
int HZF = 0;
|
HHour = ClsPub.isInt(Ds.Tables[0].Rows[0]["HHOur"]);
|
HMinute = ClsPub.isInt(Ds.Tables[0].Rows[0]["HMinute"]);
|
HSecond = ClsPub.isInt(Ds.Tables[0].Rows[0]["HSecond"]);
|
HZF = ClsPub.isInt(Ds.Tables[0].Rows[0]["HZF"]);
|
if (HZF == 0)
|
{
|
sZF = "-";
|
}
|
else
|
{
|
sZF = "";
|
}
|
TimeSpan ts = new TimeSpan(HHour, HMinute, HSecond);
|
string sSeconds = DBUtility.ClsPub.isStrNull("00" + ts.Seconds.ToString());
|
lblTimeCD.Text = sZF + (int)ts.TotalMinutes + ":" + sSeconds.Substring(sSeconds.Length - 2);
|
|
|
//string sZF = "";
|
//int cyDays = 0;
|
//int cyDayseconds = 0;
|
//int cySeconds = 0;
|
//int EndTime = 0;
|
//DateTime oAMSBTime2 = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 00:00:01");
|
//DateTime oAMSBTime = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 08:00:00");
|
//DateTime oAMXBTime = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 11:30:00");
|
//DateTime oPMSBTime = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 12:30:00");
|
//DateTime oPMXBTime = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 17:00:00");
|
//DateTime oPMXBTime2 = DBUtility.ClsPub.isDate(DateTime.Today.ToShortDateString() + " 23:59:59");
|
//otimeNow = ClsPub.isDate(DBUtility.ClsPub.GetServerDate(-1));
|
//oWorkTime = DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[iRow]["HWorkTime"]) * 60;
|
//oBegintime = DBUtility.ClsPub.isDate(DSet.Tables[0].Rows[iRow]["HBeginTime"]);
|
//TimeSpan TsDate1 = otimeNow.Subtract(oBegintime);
|
//cyDays = (int)TsDate1.TotalDays;
|
//cyDayseconds = cyDays * 16 * 60 * 60;
|
////计算上班下班时间
|
//if (otimeNow >= oAMSBTime2 && otimeNow < oAMSBTime)
|
//{
|
// return;
|
// //otimeNow = DBUtility.ClsPub.isDate(DateTime.Today.AddDays(-1).ToShortDateString() + " 17:00:00");
|
//}
|
//if (otimeNow > oAMXBTime && otimeNow < oPMSBTime)
|
//{
|
// return;
|
// //otimeNow = oPMXBTime;
|
//}
|
//if (otimeNow > oPMXBTime && otimeNow <= oPMXBTime2)
|
//{
|
// return;
|
// //otimeNow = oPMXBTime;
|
//}
|
//TimeSpan TsDate = otimeNow.Subtract(oBegintime);
|
//cySeconds = (int)TsDate.TotalSeconds;
|
//EndTime = oWorkTime - cySeconds + cyDayseconds;
|
//if (EndTime < 0)
|
//{
|
// sZF = "-";
|
//}
|
//else
|
//{
|
// sZF = "";
|
//}
|
//EndTime = System.Math.Abs(EndTime);
|
//TimeSpan ts = new TimeSpan(0, 0, EndTime);
|
//string sSeconds = DBUtility.ClsPub.isStrNull("00" + ts.Seconds.ToString());
|
//lblTimeCD.Text = sZF + (int)ts.TotalMinutes + ":" + sSeconds.Substring(sSeconds.Length - 2);
|
}
|
|
private void timer3_Tick(object sender, EventArgs e)
|
{
|
DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View();
|
//全局刷新
|
if (sTrue == false)
|
return;
|
lblICMOBillNo.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HBillNO"]);
|
lblEmp.Text = "人员:" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HEmpName"]);
|
lblMater.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HMaterName"]);
|
lblWorkTime.Text = "标准工时(m):" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HWorkTime"]);
|
lblBeginTime.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HBeginTime"]);
|
lblTimeCD.Text = "0000:00";
|
if (oEmp.GetInfoByID(DBUtility.ClsPub.isLong(DSet.Tables[0].Rows[iRow]["HEmpID"])))
|
{
|
//pEmpPic.Image = oEmp.omodel.HPic;
|
}
|
else
|
{
|
//pEmpPic.Image = null;
|
}
|
iRow = iRow + 1;
|
if (iRow > DSet.Tables[0].Rows.Count - 1)
|
{
|
iRow = 0;
|
}
|
}
|
|
private void Sc_WorkBillProcTimeReportKB2_Load(object sender, EventArgs e)
|
{
|
ClsIni oIni = new ClsIni();
|
string sID = ClsIni.ReadIni("Dept", "DeptID", Pub_Class.ClsPub.AppPath + @"\" + "HXErp_SY.ini");
|
sDeptID = sID;
|
//
|
int iHeight = 0;
|
int iWidth = 0;
|
iHeight = DBUtility.ClsPub.isInt(Math.Round(this.Height / 2.0, 0));
|
iWidth = DBUtility.ClsPub.isInt(Math.Round(this.Width / 2.0, 0));
|
pPic.Width = DBUtility.ClsPub.isInt(Math.Round(iWidth / 2.0, 0));
|
pMater.Width = iWidth + 160;
|
pEmp.Width = DBUtility.ClsPub.isInt(Math.Round(this.Width / 3.0, 0)) - 60;
|
pBaseTime.Width = DBUtility.ClsPub.isInt(Math.Round(this.Width / 3.0, 0)) - 30;
|
//
|
pBillNo.Height = DBUtility.ClsPub.isInt(Math.Round(iHeight / 5.0, 0));
|
panel2.Height = DBUtility.ClsPub.isInt(Math.Round(iHeight / 3.0, 0)) + 60;
|
splitContainer1.Height = iHeight;
|
splitContainer1.SplitterDistance= DBUtility.ClsPub.isInt(Math.Round(this.Width / 3.0, 0)) - 60;
|
//
|
Display();
|
FirstShow();
|
lblICMOBillNo.Focus();
|
}
|
|
private void FirstShow()
|
{
|
DAL.ClsGy_Employee_View oEmp = new DAL.ClsGy_Employee_View();
|
//全局刷新
|
if (sTrue == false)
|
return;
|
lblICMOBillNo.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HBillNO"]);
|
lblEmp.Text = "人员:" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HEmpName"]);
|
lblMater.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HMaterName"]);
|
lblWorkTime.Text = "标准工时(m):" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HWorkTime"]);
|
lblBeginTime.Text = DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[iRow]["HBeginTime"]);
|
lblTimeCD.Text = "0000:00";
|
if (oEmp.GetInfoByID(DBUtility.ClsPub.isLong(DSet.Tables[0].Rows[iRow]["HEmpID"])))
|
{
|
//pEmpPic.Image = oEmp.omodel.HPic;
|
}
|
else
|
{
|
//pEmpPic.Image = null;
|
}
|
|
if (iRow > DSet.Tables[0].Rows.Count - 1)
|
{
|
iRow = 0;
|
}
|
}
|
|
private void Display()
|
{
|
try
|
{
|
ClsCN SubCn = new ClsCN();
|
string sSql = "";
|
string sWhere = "";
|
//过滤条件
|
//if (frmCondition.SqlStr.Trim().Length == 0)
|
// return;
|
//sSql = frmCondition.SqlStr + sWhere + " order by HStatus,HDate ";
|
sSql = "exec h_p_Sc_WorkBillProcTimeReportKB2 " + sDeptID;
|
//
|
DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
|
//生成首行标题
|
if (DSet == null || DSet.Tables[0].Rows.Count == 0)
|
{
|
sTrue = false;
|
//MessageBox.Show("没有返回任何结果,请在过滤框中点击【恢复】按钮,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
|
SubCn.CnClose();
|
SubCn.CnDispose();
|
return;
|
}
|
sTrue = true;
|
SubCn.CnClose();
|
SubCn.CnDispose();
|
}
|
catch (Exception e)
|
{
|
return;
|
}
|
}
|
|
//下拉式 选择框 GRID
|
bool enterkey;
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
{
|
enterkey = false;
|
if (keyData == Keys.Left) //监听方向键 左 事件
|
{
|
iRow = iRow - 1;
|
if (iRow > DSet.Tables[0].Rows.Count - 1)
|
{
|
iRow = 0;
|
}
|
if (iRow < 0)
|
{
|
iRow = 0;
|
}
|
FirstShow();
|
}
|
if (keyData == Keys.Right) //监听方向键 右 事件
|
{
|
iRow = iRow + 1;
|
if (iRow > DSet.Tables[0].Rows.Count - 1)
|
{
|
iRow = 0;
|
}
|
if (iRow < 0)
|
{
|
iRow = 0;
|
}
|
FirstShow();
|
}
|
//继续原来base.ProcessCmdKey中的处理
|
return base.ProcessCmdKey(ref msg, keyData);
|
}
|
|
private void timer4_Tick(object sender, EventArgs e)
|
{
|
Display();
|
}
|
|
|
|
|
}
|
}
|