using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using SQLHelper;
|
|
namespace MES
|
{
|
public partial class Sc_ProcessReportQuery : Form
|
{
|
public Sc_ProcessReportQuery()
|
{
|
InitializeComponent();
|
}
|
public string ModName = ""; //模块名称
|
public string ModCaption = "工序汇报查询"; //模块标题
|
|
Pub_Class.ClsGridListSum oSumGrid = new Pub_Class.ClsGridListSum(); //合计网格
|
|
//初始化网格
|
/// <summary>
|
///初始化网格
|
/// </summary>
|
private void initGrid()
|
{
|
DBUtility.Xt_BaseBillFun.initGridRpt(grdMain, this.Name);
|
}
|
//
|
|
private void Display()
|
{
|
ClsCN SubCn = new ClsCN();
|
DataSet DSet = new DataSet();
|
//显示报表头 标题
|
|
//停止GRID刷新 加快速度
|
//显示过滤条件
|
|
|
//过滤条件Dlg
|
string sDlgWhere = "";
|
sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Value.ToShortDateString() + "'";
|
sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Value.ToShortDateString() + "'";
|
sDlgWhere = sDlgWhere + "," + DBUtility.ClsPub.isLong(txtHGroupID.Tag);
|
sDlgWhere = sDlgWhere + ",'" + txtHBillNo.Text.Trim() + "'";
|
sDlgWhere = sDlgWhere + ",'" + cmbHStatus.Text.Trim() + "'";
|
if (sDlgWhere.Trim().Length > 0)
|
{
|
sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1);
|
}
|
//
|
DSet = SubCn.RunProcReturn("exec h_p_Sc_ProcessReportQuery " + sDlgWhere, "Gy_Czygl", ref Pub_Class.ClsPub.sExeReturnInfo);
|
//生成首行标题
|
if (DSet == null)
|
{
|
MessageBox.Show("没有返回任何结果,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
//
|
grdMain.DataSource = DSet.Tables[0].DefaultView;
|
//设置合计列
|
string sTotalCol = "";
|
sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
|
string[] sT;
|
sT = sTotalCol.Split(Convert.ToChar(","));
|
oSumGrid.BuildTotalCols(sT);
|
//
|
DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, "是", 0);
|
//
|
DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
|
Total();
|
}
|
|
//
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
cmbHStatus.SelectedIndex = 0;
|
DBUtility.Gy_BaseFun.GetControlInfo(groupBox1, this.Name);
|
initGrid();
|
Display();
|
}
|
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void dj_Click(object sender, EventArgs e)
|
{
|
Int64 lngBillKey = 0;
|
if (grdMain.CurrentRow == null)
|
return;
|
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
|
if (lngBillKey == 0)
|
return;
|
Sc_CheckRequest oCheck = new Sc_CheckRequest();
|
oCheck.HInterID = lngBillKey;
|
oCheck.ShowDialog();
|
}
|
|
//
|
private Int32 Fun_GetCol(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
|
}
|
//
|
private void Sc_ProcessReportQuery_Load(object sender, EventArgs e)
|
{
|
SetFormCaption();
|
oSumGrid.ogrdMain = grdMain; //初始化 new
|
oSumGrid.oGridsum = grdSum;
|
}
|
|
//设置报表名称
|
private void SetFormCaption()
|
{
|
this.Text = ModCaption;
|
lblCaption.Text = this.Text;
|
initGrid();//网格标题初始化
|
}
|
|
private void cx_Click(object sender, EventArgs e)
|
{
|
DBUtility.Gy_BaseFun.SaveControlInfo(groupBox1, this.Name);
|
Display();
|
}
|
|
private void xz_Click(object sender, EventArgs e)
|
{
|
//
|
}
|
|
private void sc_Click(object sender, EventArgs e)
|
{
|
Sub_DeleteBill();
|
}
|
//删除
|
private void Sub_DeleteBill()
|
{
|
//编辑权限
|
//if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true,DBUtility.ClsPub.CurUserName))
|
//{
|
// return;
|
//}
|
////
|
//Int64 lngBillKey = 0;
|
//if (grdMain.CurrentRow == null)
|
// return;
|
//lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
|
//if (lngBillKey == 0)
|
// return;
|
//DAL.ClsSc_ProcessReport oBill = new DAL.ClsSc_ProcessReport();
|
//if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
|
//{
|
// if (MessageBox.Show("确定要删除当前单据?", "提示", MessageBoxButtons.OKCancel)==DialogResult.OK)
|
// {
|
// if (oBill.omodel.HChecker != "")
|
// {
|
// MessageBox.Show("单据已经审核,不能删除!", "提示");
|
// return;
|
// }
|
// if (!oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
|
// {
|
// MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "提示");
|
// return;
|
// }
|
// else
|
// {
|
// Display();
|
// }
|
|
// }
|
//}
|
//else
|
//{
|
// MessageBox.Show("单据未找到", "提示");
|
//}
|
}
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
timer2.Enabled = false;
|
timer1.Enabled = true;
|
}
|
|
|
|
|
private void bclk_Click(object sender, EventArgs e)
|
{
|
//保存列宽
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
|
private void mrlk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
|
}
|
//
|
|
private void GraphicsGrid()
|
{
|
DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
|
}
|
|
#region //打印设置
|
|
//GridppReport Report;
|
////预览
|
//private void yl_Click(object sender, EventArgs e)
|
//{
|
// //选择打印模板
|
// BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
|
// oFrm.sBillName = ModName;
|
// oFrm.sBillModel = ModCaption;
|
// oFrm.ShowDialog();
|
// if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
|
// {
|
// //
|
// Sub_SetReport(oFrm.sOpenTmp);
|
// Report.PrintPreview(true);
|
// }
|
//}
|
|
//private void Sub_SetReport(string sOpenTmp)
|
//{
|
// //判断行数
|
// //
|
// Report = new GridppReport();
|
// Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf"); //here .
|
// Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
|
//}
|
|
//private void ReportFetchRecordByDataTable()
|
//{
|
// //BLL.Utility.FillRecordToReport(Report, grdMain, grdPrint, Fun_GetCol("HMaterID"));
|
//}
|
|
#endregion
|
//
|
private void grdMain_Paint(object sender, PaintEventArgs e)
|
{
|
GraphicsGrid();
|
}
|
|
//合计 new
|
private void Total()
|
{
|
if (grdMain.Rows.Count > 0 && grdMain.ColumnCount > 0)
|
{
|
oSumGrid.SetGridsum();
|
oSumGrid.Total();
|
}
|
}
|
//合计 new
|
private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
|
{
|
Total();
|
}
|
//合计 new
|
private void grdMain_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
|
{
|
Total();
|
}
|
//导出EXCEL
|
private void dc_Click(object sender, EventArgs e)
|
{
|
DBUtility.Gy_BaseFun.DataToExcel(this.Text, grdMain);
|
}
|
|
private void cmdHGroupID_Click(object sender, EventArgs e)
|
{
|
DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View();
|
if (oGroup.RefreshView())
|
{
|
txtHGroupID.Tag = oGroup.oModel.HItemID.ToString();
|
txtHGroupID.Text = oGroup.oModel.HName;
|
}
|
}
|
|
private void pd_Click(object sender, EventArgs e)
|
{
|
Int64 lngBillKey = 0;
|
if (grdMain.CurrentRow == null)
|
return;
|
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
|
if (lngBillKey == 0)
|
return;
|
Sc_CheckOver oCheck = new Sc_CheckOver();
|
oCheck.HInterID = lngBillKey;
|
oCheck.ShowDialog();
|
|
}
|
|
private void rk_Click(object sender, EventArgs e)
|
{
|
//Int64 HMainID = 0;
|
//Int64 HSubID = 0;
|
//Int64 lngBillKey = 0;
|
//string sStatus = "";
|
//if (grdMain.CurrentRow == null)
|
// return;
|
//HMainID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("HMainID")].Value);
|
//HSubID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("HSubID")].Value);
|
//lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("HICMOInterID")].Value);
|
//sStatus = DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("状态")].Value);
|
//if (lngBillKey == 0 || HMainID == 0)
|
// return;
|
//DAL.ClsSc_ProcessReport oProcessR = new DAL.ClsSc_ProcessReport();
|
//if (!oProcessR.CheckStatus(HMainID, HSubID, ref DBUtility.ClsPub.sExeReturnInfo))
|
//{
|
// MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo);
|
// return;
|
//}
|
////
|
//WarM.Kf_ProductInBill_K3 oBill = new WarM.Kf_ProductInBill_K3();
|
//oBill.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
//oBill.sHICMOInterID = lngBillKey;
|
//oBill.ShowDialog();
|
}
|
|
private void yj_Click(object sender, EventArgs e)
|
{
|
Int64 lngBillKey = 0;
|
if (grdMain.CurrentRow == null)
|
return;
|
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
|
if (lngBillKey == 0)
|
return;
|
Sc_ProcessMove oCheck = new Sc_ProcessMove();
|
oCheck.ShowDialog();
|
}
|
|
private void hb_Click(object sender, EventArgs e)
|
{
|
Int64 lngBillKey = 0;
|
if (grdMain.CurrentRow == null)
|
return;
|
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
|
if (lngBillKey == 0)
|
return;
|
DAL.ClsSc_ProcessReport oBill = new DAL.ClsSc_ProcessReport();
|
if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
Sc_ProcessReport_Simple oFrm = new Sc_ProcessReport_Simple();
|
oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
oFrm.BillOld = oBill;
|
oFrm.ShowDialog();
|
}
|
else
|
{
|
MessageBox.Show("单据未找到", "提示");
|
}
|
oBill = null;
|
}
|
|
|
|
}
|
}
|