using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using gregn6Lib;
|
|
namespace SCM
|
{
|
public partial class Sc_ProcessReportDel : Form
|
{
|
public Sc_ProcessReportDel()
|
{
|
InitializeComponent();
|
}
|
//public DBUtility.frmBillQueryCondition_New frmCondition;
|
public string ViewName = "Get_ICMOBillInfo";
|
public string ModCaption = "生产订单取消报工";
|
public string HInnerBillNo = "";
|
public const string ModName = "3714";
|
public const string ModRightName = "Sc_ProcessReportDel";
|
public const string ModRightNameEdit = ModRightName + "_Edit";
|
public const string ModRightNameCheck = ModRightName + "_Check";
|
public const string ModRightNameClose = ModRightName + "_Close";
|
public const string ModRightNameDelete = ModRightName + "_Delete";
|
public int HHGQtyCol = 0;
|
public int HBHGQtyCol = 0;
|
public int HQtyCol = 0;
|
public int HICMOInterIDCol = 0;
|
public int HICMOEntryIDCol = 0;
|
public int HICMOBillNoCol = 0;
|
public int HMaterialIDCol = 0;
|
public int HMaterialNumberCol = 0;
|
public int HDeptIDCol = 0;
|
public int HDeptNumberCol = 0;
|
public int HJTIDCol = 0;
|
public int HWHIDCol = 0;
|
public int HWHNameCol = 0;
|
public int HSPIDCol = 0;
|
public int HSPNameCol = 0;
|
public Sc_ProcessReportDel oFrm;
|
Pub_Class.ClsGridViewSum oSumGrid = new Pub_Class.ClsGridViewSum();
|
public Int32 iTopRow = 0;//画横线
|
public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
|
|
//
|
private void initGrid()
|
{
|
DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name);
|
grdMain.CellBorderStyle = DataGridViewCellBorderStyle.Single; //网格线样式:显示网格线
|
grdMain.ReadOnly = false;
|
}
|
//
|
|
private void Display()
|
{
|
string HBillNo = "";
|
HBillNo = txtHICMOBillNo.Text.Trim().ToString();
|
string HMaterNumber = "";
|
HMaterNumber = txtHMaterID2.Text.Trim().ToString();
|
string HMaterName = "";
|
HMaterName = txtHMaterName2.Text.Trim().ToString();
|
string HMaterModel = "";
|
HMaterModel = txtHMaterModel2.Text.Trim().ToString();
|
string HBeginDate = "";
|
HBeginDate = dtpHBDate.Value.ToShortDateString();
|
string HEndDate = "";
|
HEndDate = dtpHEDate.Value.ToShortDateString();
|
long HDeptNumber = 0;
|
HDeptNumber = DBUtility.ClsPub.isLong(txtHDeptID.Tag);
|
string HJT = "";
|
HJT = txtHJT.Text.Trim().ToString();
|
DataSet DSet;
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
DSet = oWeb.Get_ICMOBillInfo("exec Get_ProcReportInfoDel '" + HBillNo + "' , '" + HMaterNumber + "', '" + HMaterName + "', '" + HMaterModel + "' ,'" + HBeginDate + "' ,'" + HEndDate + "' , '" + HDeptNumber + "' ,'" + HJT + "'", "Get_ProcReportInfoDel", ref DBUtility.ClsPub.sExeReturnInfo);
|
//DSet = oCn.RunProcReturn("exec Get_ProcReportInfoDel '" + HBillNo + "' , '" + HMaterNumber + "' , '" + HMaterNumber2 + "' ,'" + HBeginDate + "' ,'" + HEndDate + "' , '" + HDeptNumber + "' ,'" + HJT + "'", "Get_ProcReportInfoDel", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DSet == null || DSet.Tables[0].Rows.Count == 0)
|
{
|
grdMain.DataSource = null;
|
MessageBox.Show("没有返回任何结果,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
grdMain.DataSource = DSet.Tables[0].DefaultView;
|
//设置合计列
|
//string sTotalCol = "";
|
//string[] sT;
|
//sT = sTotalCol.Split(Convert.ToChar(","));
|
//oSumGrid.BuildTotalCols(sT);
|
//
|
//冻结
|
//int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
|
//string s = frmCondition.cmbHComplete.Text;
|
//DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
|
//画线
|
SCM.公用类.Xt_BaseBillFun.DisplayGrid(grdMain);
|
GraphLine();
|
|
Total();
|
HBHGQtyCol = Fun_GetCol("不合格实收数量");
|
HHGQtyCol = Fun_GetCol("合格实收数量");
|
|
}
|
//
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
initGrid();
|
Display();
|
}
|
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
private void sx_Click(object sender, EventArgs e)
|
{
|
timer1.Enabled = true;
|
}
|
|
private void dj_Click(object sender, EventArgs e)
|
{
|
Sub_ShowBill();
|
}
|
//显示单据
|
private void Sub_ShowBill()
|
{
|
|
}
|
//
|
private Int32 Fun_GetCol(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
|
}
|
//
|
private void Sc_ProcessReportDel_Load(object sender, EventArgs e)
|
{
|
oWeb.Url = ClsPub1.WEBSURL;
|
//
|
//frmCondition = new DBUtility.frmBillQueryCondition_New();
|
oSumGrid.ogrdMain = grdMain; //初始化 new
|
oSumGrid.oGridsum = grdSum;
|
dtpHBDate.Value = DateTime.Today.AddDays(-30);
|
dtpHEDate.Value = DateTime.Today;
|
this.Text = ModCaption;
|
lblCaption.Text = ModCaption;
|
initGrid();
|
}
|
|
private void grdMain_DblClick(object sender, EventArgs e)
|
{
|
|
//Sub_ShowBill();
|
}
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
}
|
|
|
|
|
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 GraphLine()
|
{
|
int MainIDCol = Fun_GetCol("hmainid");
|
int SubIDCol = Fun_GetCol("hsubid");
|
//string s = frmCondition.cmbHComplete.Text;
|
long n = 0;
|
//DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s, ref n);
|
//显示
|
lbldj.Text = "查询出 " + n.ToString() + " 张单据";
|
lbljl.Text = "共有 " + grdMain.RowCount.ToString() + " 条记录";
|
}
|
|
private void GraphicsGrid()
|
{
|
DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
|
DBUtility.Xt_BaseBillFun.GraphicsRowGrid(grdMain, iTopRow, iTopRow + 50, Fun_GetCol("hmainid"));
|
}
|
|
#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()
|
{
|
try
|
{
|
//BLL.Utility.FillRecordToReport(Report, grdMain, grdPrint, Fun_GetCol("HMaterID"));
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("打印失败!:" + e.Message);
|
}
|
}
|
|
#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 cx_Click(object sender, EventArgs e)
|
{
|
Display();
|
}
|
|
private void grdMain_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
//RowCount(e.RowIndex, 0); //计算 金额 单价
|
//
|
if (this.EditingControl != null) //释放事件
|
{
|
EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown);
|
this.EditingControl = null;
|
}
|
}
|
|
DataGridViewTextBoxEditingControl EditingControl;
|
private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
|
{
|
int i = grdMain.CurrentCell.ColumnIndex;
|
|
string s = DBUtility.ClsPub.isStrNull(grdMain.Columns[i].HeaderText);
|
if (s == "合格实收数量" || s == "不合格实收数量" || s == "合格收货仓库" || s == "合格收货仓位")
|
{
|
e.Cancel = false;
|
}
|
else
|
{
|
e.Cancel = true;
|
}
|
}
|
|
private void cmdHMaterID2_Click(object sender, EventArgs e)
|
{
|
SCM.ClsCLD_Material_View oMater = new SCM.ClsCLD_Material_View();
|
string MaWhere = "";
|
MaWhere = " and HUSEORGID = " + ClsPub1.HOrgID;
|
if (oMater.RefreshView(MaWhere))
|
{
|
this.txtHMaterID2.Text = oMater.omodel.HNumber;
|
this.txtHMaterID2.Tag = oMater.omodel.HItemID.ToString();
|
this.txtHMaterName2.Text = oMater.omodel.HName;
|
this.txtHMaterModel2.Text = oMater.omodel.HModel;
|
}
|
else
|
{
|
this.txtHMaterID2.Text = "";
|
this.txtHMaterID2.Tag = 0;
|
this.txtHMaterName2.Text = "";
|
this.txtHMaterModel2.Text = "";
|
}
|
}
|
|
private void cmdHMaterID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsCLD_Material_View oMater = new SCM.ClsCLD_Material_View();
|
string MaWhere = "";
|
MaWhere = " and HUSEORGID = " + ClsPub1.HOrgID;
|
if (oMater.RefreshView(MaWhere))
|
{
|
this.txtHMaterID.Text = oMater.omodel.HNumber;
|
this.txtHMaterID.Tag = oMater.omodel.HItemID.ToString();
|
this.txtHMaterName.Text = oMater.omodel.HName;
|
this.txtHMaterModel.Text = oMater.omodel.HModel;
|
}
|
else
|
{
|
this.txtHMaterID.Text = "";
|
this.txtHMaterID.Tag = 0;
|
this.txtHMaterName.Text = "";
|
this.txtHMaterModel.Text = "";
|
}
|
}
|
|
private void cmdHDeptID_Click(object sender, EventArgs e)
|
{
|
SCM.ClsCLD_Department_View oDept = new SCM.ClsCLD_Department_View();
|
string DeWhere = "";
|
DeWhere = " and HUSEORGID = " + ClsPub1.HOrgID;
|
if (oDept.RefreshView(DeWhere))
|
{
|
this.txtHDeptID.Text = oDept.oModel.HName;
|
this.txtHDeptID.Tag = oDept.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHDeptID.Text = "";
|
this.txtHDeptID.Tag = 0;
|
}
|
}
|
|
|
private void BG_Click(object sender, EventArgs e)
|
{
|
DataSet DSet;
|
if (grdMain.CurrentRow == null)
|
return;
|
long lngBillKey = 0;
|
long lngBillKeyEntry = 0;
|
|
lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("HInterID")].Value);
|
lngBillKeyEntry = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("HEntryID")].Value);
|
if (lngBillKey == 0 || lngBillKeyEntry==0)
|
return;
|
if (MessageBox.Show("确定要取消该报工单吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
|
{
|
DSet = oWeb.Get_ICMOBillInfo("exec Del_ProcReportInfo '" + lngBillKey + "' , '" + lngBillKeyEntry + "' ", "Del_ProcReportInfo", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DSet == null || DSet.Tables[0].Rows.Count == 0)
|
{
|
|
return;
|
}
|
if (DBUtility.ClsPub.isLong(DSet.Tables[0].Rows[0][0]) == 0)
|
{
|
MessageBox.Show(DSet.Tables[0].Rows[0][1].ToString());
|
return;
|
}
|
else {
|
oWeb.getRunProc("exec Del_ProcReport '" + lngBillKey + "' , '" + lngBillKeyEntry + "' ", ref DBUtility.ClsPub.sExeReturnInfo);
|
MessageBox.Show(DSet.Tables[0].Rows[0][1].ToString());
|
Display();
|
return;
|
}
|
}
|
|
}
|
|
private void bty_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit)
|
{
|
|
//DAL.ClsCLD_Process_View oProc = new DAL.ClsCLD_Process_View();
|
//DAL.ClsCLD_Employee_View oEmp = new DAL.ClsCLD_Employee_View();
|
SCM.ClsCLD_Material_View oMater = new SCM.ClsCLD_Material_View();
|
//DAL.ClsCLD_Unit_View oUnit = new DAL.ClsCLD_Unit_View();
|
//DAL.ClsCLD_Source_View oSource = new DAL.ClsCLD_Source_View();
|
//DAL.ClsCLD_ORGANIZATIONS_View oOrg = new DAL.ClsCLD_ORGANIZATIONS_View();
|
SCM.ClsCLD_Warehouse_View oWare = new SCM.ClsCLD_Warehouse_View();
|
SCM.ClsCLD_StockPlace_View oSp = new SCM.ClsCLD_StockPlace_View();
|
//if (!grdStatus)
|
//{
|
// return;
|
//}
|
//if (oSumGrid.FindAllowEditCol(sCol))
|
//{
|
oSumGrid.EditStatus = true;
|
//}
|
//else
|
//{
|
// return;
|
//}
|
switch (sKeyCode)
|
{
|
case 118: //F7
|
{
|
int i = grdMain.CurrentCell.ColumnIndex;
|
|
string s = DBUtility.ClsPub.isStrNull(grdMain.Columns[i].HeaderText);
|
if (s == "合格收货仓库")
|
{
|
//oOrg.GetInfoByName(cmbHOrg.Text);
|
oWare.WherePart = "";
|
//if (oWare.RefreshView(" and HUSEORGID =" + oOrg.omodel.HItemID))
|
if (oWare.RefreshView())
|
{
|
grdMain.Rows[sRow].Cells[HWHIDCol].Value = oWare.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HWHNameCol].Value = oWare.oModel.HName;
|
grdMain.Rows[sRow].Cells[HSPIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HSPNameCol].Value = "";
|
oEdit.Text = oWare.oModel.HName;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HWHIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HWHNameCol].Value = "";
|
grdMain.Rows[sRow].Cells[HSPIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HSPNameCol].Value = "";
|
}
|
}
|
if (s == "合格收货仓位")
|
{
|
//oOrg.GetInfoByName(cmbHOrg.Text);
|
oSp.WherePart = "";
|
if (oSp.RefreshView(" and HWHID = '" + DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HWHIDCol].Value) + "'"))
|
//if (oSp.RefreshView(" and HWHID = '" + DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HWHIDCol].Value) + "' and HUSEORGID =" + oOrg.omodel.HItemID))
|
{
|
grdMain.Rows[sRow].Cells[HWHIDCol].Value = oSp.omodel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HWHNameCol].Value = oSp.omodel.HName;
|
grdMain.Rows[sRow].Cells[HSPIDCol].Value = oSp.omodel.HMainStockID.ToString();
|
grdMain.Rows[sRow].Cells[HSPNameCol].Value = oSp.omodel.HMainStockName;
|
oEdit.Text = oSp.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HWHIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HWHNameCol].Value = "";
|
grdMain.Rows[sRow].Cells[HSPIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HSPNameCol].Value = "";
|
}
|
}
|
|
|
//case HMaterNumberCol:
|
// oOrg.GetInfoByName(cmbHOrg.Text);
|
// oMater.WherePart = "";
|
// if (oMater.RefreshView(" and HUSEORGID =" + oOrg.omodel.HItemID))
|
// {
|
// grdMain.Rows[sRow].Cells[HMaterIDCol].Value = oMater.omodel.HItemID.ToString();
|
// grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
|
// grdMain.Rows[sRow].Cells[HMaterNameCol].Value = oMater.omodel.HName;
|
// grdMain.Rows[sRow].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
|
// grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oMater.omodel.HUnitID.ToString();
|
// grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = oMater.omodel.HUnitNumber;
|
// grdMain.Rows[sRow].Cells[HUnitNameCol].Value = oMater.omodel.HUnitName;
|
// }
|
// else
|
// {
|
// grdMain.Rows[sRow].Cells[HMaterIDCol].Value = 0;
|
// grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = "";
|
// grdMain.Rows[sRow].Cells[HMaterNameCol].Value = "";
|
// grdMain.Rows[sRow].Cells[HMaterModelCol].Value = "";
|
// grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0;
|
// grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = "";
|
// grdMain.Rows[sRow].Cells[HUnitNameCol].Value = "";
|
// }
|
// break;
|
|
|
}
|
break;
|
}
|
}
|
private void EditingControl_KeyDown(object sender, KeyEventArgs e)
|
{
|
//业务处理
|
Sub_GridKey(e.KeyValue, grdMain.CurrentRow.Index, grdMain.CurrentCell.ColumnIndex, EditingControl);
|
}
|
|
private void grdMain_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
|
{
|
if (grdMain.CurrentCell != null)
|
{
|
if (e.Control is DataGridViewTextBoxEditingControl)
|
{
|
this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control;
|
//增加委托处理
|
this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown);
|
}
|
}
|
}
|
|
private void txtHMaterID2_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHMaterID2.Text.Trim() == "")
|
{
|
txtHMaterID2.Tag = "0";
|
txtHMaterName2.Text = "";
|
txtHMaterModel2.Text = "";
|
}
|
}
|
}
|
}
|