using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using BaseSet; using System.Threading; using SQLHelper; using DBUtility; using gregn6Lib; namespace APSM { public partial class Sc_SeOrderAutoSortBill_RG : Form { public Sc_SeOrderAutoSortBill_RG() { InitializeComponent(); } //¶¨ÒåÁÐ int HFixCol = 26; int selectcol = 0; int HWhIDCol = 0; int HWhNameCol = 0; int HWhName_SelCol = 0; int HModelCol = 0; int HPCQtyCol = 0; //¿ÉÅÅÊýÁ¿ int HAreaIDCol = 0; int HAreaNameCol = 0; int HRoutingIDCol = 0; int HRoutingNameCol = 0; int HDiameter1Col = 0; int HDiameter2Col = 0; int HDiameter3Col = 0; int HBillingIDCol = 0; int HBillingNameCol = 0; int HFormulaIDCol = 0; int HFormulaNameCol = 0; int HMaterIDCol = 0; int HUnitIDCol = 0; int HSeOrderInterIDCol = 0; int HSeOrderEntryIDCol = 0; int HSeOrderBillNoCol = 0; // int HICMOInterIDCol = 0; //int HSeOrderTypeCol = 0; //int HICMOMakerCol = 0; //int HCheckDateCol = 0; //int HPackTypeCol = 0; //int HICMOBillNoCol = 0; //int HCusNameCol = 0; //int HBatchNoCol = 0; //int HStockNameCol = 0; //int HMaterTypeCol = 0; //int HMaterModelCol = 0; //int HSeOrderQtyCol = 0; //int HSeOrderWeightCol = 0; //int HsecAreaNameCol = 0; //int HsecBillingNoCol = 0; //int HsecFormulaNameCol = 0; //int HsecNoCol = 0; // public string ModName = "3749"; public string ModCaption = "Éú²úÅŲú"; // public DBUtility.ClsPub.Enum_BillStatus BillStatus; public string sAllowCol; // SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); DAL.ClsSc_WorkBillAutoSortBill oMain = new DAL.ClsSc_WorkBillAutoSortBill(); BLL.FrmMonthCalendar oSelectDate = new BLL.FrmMonthCalendar(); DAL.ClsSc_ICMOSortBill oMainPC = new DAL.ClsSc_ICMOSortBill(); // bool bEdit = false; //ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ private bool IsSelectCell(int iRow,int iCol) { return false; //return BLL.Sc_SeOrderAutoSortBill_RGFun.IsSelectCell(grdSourceBill, iRow, iCol); } //ÁÐÊÇ·ñÔÊÐí±à¼­ private bool IsAllowEdit(int iRow, int iCol) { return false; //return BLL.Sc_SeOrderAutoSortBill_RGFun.IsAllowEdit(grdSourceBill,FixCols, iRow, iCol); } private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled = false; //³õʼ»¯ initGrid(); Display_SeOrder(); Display_ICMO(); } //³õʼ»¯Íø¸ñ private void initGrid() { DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeOrder, this.Name + "grdSourceBill"); DBUtility.Xt_BaseBillFun.initGridList(grdSource_ICMO, this.Name + "grdMain"); DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeSub, this.Name + "grdSource"); grdSource_SeOrder.ReadOnly = false; } private void Display_SeOrder()//¶ÁÈ¡ÏúÊÛ¶©µ¥ { ClsCN SubCn = new ClsCN(); DataSet DSet; //ÏÔʾ±¨±íÍ· ±êÌâ //¹ýÂËÌõ¼þDlg string sDlgWhere = ""; sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + txtHBillNo.Text.Trim() + "'"; sDlgWhere = sDlgWhere + "," + DBUtility.ClsPub.isLong(txtHCusID.Tag).ToString(); sDlgWhere = sDlgWhere + ",'" + txtHModel.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + txtHBatchNo.Text.Trim() + "'"; if (sDlgWhere.Trim().Length > 0) { sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1); } // DSet = SubCn.RunProcReturn("exec h_p_Sc_SeOrderAutoSortBill_SourceBill_K3 " + sDlgWhere, "h_p_Sc_SeOrderAutoSortBill_SourceBill_K3"); //Éú³ÉÊ×ÐбêÌâ if (DSet == null) { MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo); return; } // grdSource_SeOrder.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(grdSource_SeOrder, this.Name + "grdSource_SeOrder", "ÊÇ", 0); // DBUtility.Xt_BaseBillFun.GetGrid(grdSource_SeOrder, this.Name + "grdSource_SeOrder"); //Total(); HPCQtyCol = Fun_GetCol_SourceBill("¿ÉÅžíÊý"); selectcol = Fun_GetCol_SourceBill("Ñ¡Ôñ"); HModelCol = Fun_GetCol_SourceBill("ëÁÏԭʼ¹æ¸ñ"); HMaterIDCol = Fun_GetCol_SourceBill("HMaterID"); HUnitIDCol = Fun_GetCol_SourceBill("HUnitID"); HSeOrderInterIDCol = Fun_GetCol_SourceBill("HSeOrderInterID"); HSeOrderEntryIDCol = Fun_GetCol_SourceBill("HSeOrderEntryID"); HSeOrderBillNoCol = Fun_GetCol_SourceBill("HSeOrderBillNo"); // HAreaIDCol = Fun_GetCol_SourceBill("HAreaID"); HAreaNameCol = Fun_GetCol_SourceBill("Ñ¡²úµØ"); HRoutingIDCol = Fun_GetCol_SourceBill("HRoutingID"); HRoutingNameCol = Fun_GetCol_SourceBill("Ñ¡¹¤ÒÕ´úÂë"); HDiameter1Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶1"); HDiameter2Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶2"); HDiameter3Col = Fun_GetCol_SourceBill("Ñ¡À­Ë¿Ö±¾¶3"); HWhIDCol = Fun_GetCol_SourceBill("HWhID"); HWhNameCol = Fun_GetCol_SourceBill("²ÄÁϲֿâ"); HWhName_SelCol = Fun_GetCol_SourceBill("Ñ¡²ÄÁϲֿâ"); HBillingIDCol = Fun_GetCol_SourceBill("HBillingID"); HBillingNameCol = Fun_GetCol_SourceBill("Ñ¡Çò»¯Â¯ºÅ"); HFormulaIDCol = Fun_GetCol_SourceBill("HFormulaID"); HFormulaNameCol = Fun_GetCol_SourceBill("Ñ¡Åä·½ºÅ"); // HFixCol = HAreaIDCol; } private void Display_SeSub() { ClsCN SubCn = new ClsCN(); DataSet DSet; //ÏÔʾ±¨±íÍ· ±êÌâ //¹ýÂËÌõ¼þDlg string sDlgWhere = ""; if (sDlgWhere.Trim().Length > 0) { sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1); } // DSet = SubCn.RunProcReturn("exec h_p_K3_SeOrderAutoSortBill_Main " + sDlgWhere, "h_p_K3_SeOrderAutoSortBill_Main"); //Éú³ÉÊ×ÐбêÌâ if (DSet == null) { MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo); return; } // grdSource_ICMO.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(grdSource_ICMO, this.Name + "grdMain", "ÊÇ", 0); // DBUtility.Xt_BaseBillFun.GetGrid(grdSource_ICMO, this.Name + "grdMain"); //Total(); } private void Display_ICMO() { ClsCN SubCn = new ClsCN(); DataSet DSet; //¹ýÂËÌõ¼þDlg string sDlgWhere = ""; sDlgWhere = sDlgWhere + ",'" + dtpHBDate.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + dtpHEDate.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + txtHBillNo.Text.Trim() + "'"; sDlgWhere = sDlgWhere + "," + DBUtility.ClsPub.isLong(txtHCusID.Tag).ToString(); sDlgWhere = sDlgWhere + ",'" + txtHModel.Text.Trim() + "'"; sDlgWhere = sDlgWhere + ",'" + txtHBatchNo.Text.Trim() + "'"; if (sDlgWhere.Trim().Length > 0) { sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1); } // DSet = SubCn.RunProcReturn("exec h_p_Sc_SeOrderAutoSortBill_ICMO_K3 " + sDlgWhere, "h_p_Sc_SeOrderAutoSortBill_ICMO_K3"); //Éú³ÉÊ×ÐбêÌâ if (DSet == null) { MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo); return; } // grdSource_ICMO.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(grdSource_ICMO, this.Name + "grdSource_ICMO", "ÊÇ", 0); // DBUtility.Xt_BaseBillFun.GetGrid(grdSource_ICMO, this.Name + "grdSource_ICMO"); //Total(); HICMOInterIDCol = Fun_GetCol_Main("HInterID"); // } //½»»õÆÚ ³¬ÆÚʱ ±äÉ« private void AddColor() { //BLL.Sc_SeOrderAutoSortBill_RGFun.AddColor(grdSourceBill, HPlanEndDateCol, FixCols); } //±£´æ private void SaveBill() { SQLHelper.ClsCNK3 oK3Cn = new SQLHelper.ClsCNK3(); ClsCN SubCn = new ClsCN(); DataSet DSet; DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3(); //for (int i = 0; i <= grdSource_SeOrder.RowCount - 1; i++) //{ // if (DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[i].Cells[selectcol].Value) == "¡Ì") // { // } //} //±£´æµ±Ç°Ñ¡ÔñÐÐ if (grdSource_SeOrder.CurrentRow == null) { return; } //»ñÈ¡µ¥¾ÝºÅ DataSet Ds = oK3Cn.RunProcReturn("exec HX_GetICBillNo 1,85 " , "t_billcodeby"); string sICMOBillno = Ds.Tables[0].Rows[0][0].ToString().Trim(); int HCurRow = grdSource_SeOrder.CurrentRow.Index; BillNew = new DAL.ClsSc_ICMOBill_K3(); BillNew.omodel.HYear = 2011; BillNew.omodel.HPeriod = 1; BillNew.omodel.HBillNo = sICMOBillno; //ÔÚ¸³ÖµÀàǰ¾Í´¦ÀíºÃ×Ö·û´®ºÍÊý×Ö BillNew.omodel.HDate = DateTime.Today; BillNew.omodel.HPlanBeginDate = DateTime.Today; BillNew.omodel.HPlanEndDate = DateTime.Today; BillNew.omodel.HBeginDate = DateTime.Today; BillNew.omodel.HEndDate = DateTime.Today; BillNew.omodel.HEmpID =0; BillNew.omodel.HEmpNumber = ""; BillNew.omodel.HDeptID = 278 ; BillNew.omodel.HDeptNumber = ""; BillNew.omodel.HCenterID = 0; BillNew.omodel.HCenterNumber = ""; BillNew.omodel.HCusID = 0; BillNew.omodel.HCusNumber = ""; BillNew.omodel.HMaterID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HMaterIDCol].Value); BillNew.omodel.HMaterNumber = ""; BillNew.omodel.HUnitID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HUnitIDCol].Value); BillNew.omodel.HUnitNumber = ""; BillNew.omodel.HBomID = 0; BillNew.omodel.HBomNumber = ""; BillNew.omodel.HRoutingInterID =0; BillNew.omodel.HPlanQty = DBUtility.ClsPub.isDoule(grdSource_SeOrder.Rows[HCurRow].Cells[HPCQtyCol].Value); BillNew.omodel.HReadyQty =0; BillNew.omodel.HLevNum = 0; BillNew.omodel.HSeOrderInterID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderInterIDCol].Value); BillNew.omodel.HSeOrderEntryID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderEntryIDCol].Value); BillNew.omodel.HSeOrderBillNo = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HSeOrderBillNoCol].Value); BillNew.omodel.HRemark = ""; BillNew.omodel.HDiameter1 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter1Col].Value); BillNew.omodel.HDiameter2 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter2Col].Value); BillNew.omodel.HDiameter3 = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[HCurRow].Cells[HDiameter3Col].Value); BillNew.omodel.HWhID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HWhIDCol].Value); BillNew.omodel.HBillingID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HBillingIDCol].Value); BillNew.omodel.HFormulaID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HFormulaIDCol].Value); BillNew.omodel.HAreaID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HAreaIDCol].Value); BillNew.omodel.HRoutingID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[HCurRow].Cells[HRoutingIDCol].Value); // bool bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo); if (bResult == true) { MessageBox.Show("µ¥¾Ý´æÅÌÍê±Ï!µ¥¾ÝºÅ:" + sICMOBillno, "Ìáʾ"); } else { MessageBox.Show("±£´æÊ§°Ü!Ô­Òò:" + ClsPub.sExeReturnInfo, "Ìáʾ"); } } //±£´æµ¥ÐÐ private void SaveSingeBill(int iRow, int iRowSub, Int64 HRelationInterID, List oClsGridVaules) { } //±£´æÇ° ¼ì²é private bool AllowSave() { return true; } //ÊÇ·ñÊǺÏÀíÐÐ private bool AllowRow() { if (grdSource_SeOrder.CurrentRow == null) { return false; } else { return true; } } //¼ÓÔØ ѡԴµ¥ private void sx_Click(object sender, EventArgs e) { DAL.Cls_S_K3_SeOrderBillList oSeOrderBillList = new DAL.Cls_S_K3_SeOrderBillList(); string sWhere = ""; if (oSeOrderBillList.Refresh(sWhere)) //Ñ¡ÔñÔ­µ¥ { FillSelectData(oSeOrderBillList.oBillSelectColl); } } //¼ÓÔØ Ô­µ¥µ½±¾µØ private void FillSelectData(List oList) { } //¸ù¾ÝTABLEдÈë½çÃæ private void Sub_WriteInForm(DataTable oTable, int i) { } //±£´æÁпí private void bclk_Click(object sender, EventArgs e) { //±£´æÁпí DBUtility.ClsPub.SaveGridView(grdSource_SeSub, this.Name + "grdSource_SeSub", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdSource_SeOrder, this.Name + "grdSource_SeOrder", DBUtility.ClsPub.AppPath); DBUtility.ClsPub.SaveGridView(grdSource_ICMO, this.Name + "grdSource_ICMO", DBUtility.ClsPub.AppPath); } //ĬÈÏÁпí private void mrlk_Click(object sender, EventArgs e) { DBUtility.ClsPub.DefaultGridView(grdSource_SeSub); DBUtility.ClsPub.DefaultGridView(grdSource_SeOrder); DBUtility.ClsPub.DefaultGridView(grdSource_ICMO); } //Í˳ö°´Å¥ private void tc_Click(object sender, EventArgs e) { this.Close(); } //±£´æ°´Å¥ private void bc_Click(object sender, EventArgs e) { SaveBill(); } //ÄÜÁ¦°´Å¥ private void nl_Click(object sender, EventArgs e) { //ÄÜÁ¦ÉèÖà //Gy_WorkTimes oFrm = new Gy_WorkTimes(); //oFrm.ShowDialog(); } private void Sc_SeOrderAutoSortBill_RG_Load(object sender, EventArgs e) { this.Text = ModCaption; this.lblCaption.Text = ModCaption; } const int sHWhNameCol = 33; //°ïÖúº¯Êý private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit) { DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View(); //DAL.ClsK3_DrawingDire_View oDrawingDire = new DAL.ClsK3_DrawingDire_View(); DAL.ClsK3_FormulaName_View oFormulaName = new DAL.ClsK3_FormulaName_View(); DAL.ClsK3_OrderType_View oOrderType = new DAL.ClsK3_OrderType_View(); DAL.ClsK3_PackType_View oPackType = new DAL.ClsK3_PackType_View(); DAL.ClsK3_Place_View oPlace = new DAL.ClsK3_Place_View(); DAL.ClsK3_ProcessFlow_View oProcessFlow = new DAL.ClsK3_ProcessFlow_View(); DAL.ClsK3_Specifications_View oSpecifications = new DAL.ClsK3_Specifications_View(); DAL.ClsK3_SpheroidizingNumber_View oSpheroidizingNumber = new DAL.ClsK3_SpheroidizingNumber_View(); //if (!grdStatus) //{ // return; //} //if (oSumGrid.FindAllowEditCol(sCol)) //{ //oSumGrid.EditStatus = true; //} //else //{ // return; //} switch (sKeyCode) { case 118: //F7 { switch (sCol) { case sHWhNameCol: //oWh.WherePart = ""; //if (oWh.RefreshView()) //{ // grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = oWh.oModel.HItemID.ToString(); // grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = oWh.oModel.HName; //} //else //{ // grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = 0; // grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = ""; //} break; default: break; } if (sCol == HWhName_SelCol) { if (oWh.RefreshView()) { grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = oWh.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = oWh.oModel.HName; grdSource_SeOrder.Rows[sRow].Cells[HWhName_SelCol].Value = oWh.oModel.HName; } else { grdSource_SeOrder.Rows[sRow].Cells[HWhIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HWhNameCol].Value = ""; grdSource_SeOrder.Rows[sRow].Cells[HWhName_SelCol].Value = ""; } } if (sCol == HAreaNameCol) { oPlace.WherePart = ""; if (oPlace.RefreshView()) { grdSource_SeOrder.Rows[sRow].Cells[HAreaIDCol].Value = oPlace.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HAreaNameCol].Value = oPlace.oModel.HName; } else { grdSource_SeOrder.Rows[sRow].Cells[HAreaIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HAreaNameCol].Value = ""; } } if (sCol == HFormulaNameCol) { oFormulaName.WherePart = ""; if (oFormulaName.RefreshView()) { grdSource_SeOrder.Rows[sRow].Cells[HFormulaIDCol].Value = oFormulaName.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HFormulaNameCol].Value = oFormulaName.oModel.HName; } else { grdSource_SeOrder.Rows[sRow].Cells[HFormulaIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HFormulaNameCol].Value = ""; } } if (sCol == HBillingNameCol) { oSpheroidizingNumber.WherePart = ""; if (oSpheroidizingNumber.RefreshView()) { grdSource_SeOrder.Rows[sRow].Cells[HBillingIDCol].Value = oSpheroidizingNumber.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HBillingNameCol].Value = oSpheroidizingNumber.oModel.HName; } else { grdSource_SeOrder.Rows[sRow].Cells[HBillingIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HBillingNameCol].Value = ""; } } if (sCol == HRoutingNameCol) { oProcessFlow.WherePart = ""; if (oProcessFlow.RefreshView()) { grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = oProcessFlow.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HRoutingNameCol].Value = oProcessFlow.oModel.HName; } else { grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HRoutingNameCol].Value = ""; } } if (sCol == HDiameter1Col) { oSpecifications.WherePart = ""; if (oSpecifications.RefreshView()) { //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HName; } else { //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = ""; } } if (sCol == HDiameter2Col) { oSpecifications.WherePart = ""; if (oSpecifications.RefreshView()) { //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HDiameter2Col].Value = oSpecifications.oModel.HName; } else { //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HDiameter2Col].Value = ""; } } if (sCol == HDiameter3Col) { oSpecifications.WherePart = ""; if (oSpecifications.RefreshView()) { //grdSource_SeOrder.Rows[sRow].Cells[HDiameter1Col].Value = oSpecifications.oModel.HItemID.ToString(); grdSource_SeOrder.Rows[sRow].Cells[HDiameter3Col].Value = oSpecifications.oModel.HName; } else { //grdSource_SeOrder.Rows[sRow].Cells[HRoutingIDCol].Value = 0; grdSource_SeOrder.Rows[sRow].Cells[HDiameter3Col].Value = ""; } } break; } case 117: //F6 { switch (sCol) { default: break; } break; } default: break; } } private void sx_Click_1(object sender, EventArgs e) { initGrid(); Display_ICMO(); Display_SeOrder(); } private void glxx_Click(object sender, EventArgs e) { tbc1.Visible = !tbc1.Visible; if (tbc1.Visible == false) { spc1.SplitterDistance = spc1.Size.Height-20; } else { spc1.SplitterDistance = spc1.Size.Height-200; } } //ÈÎÎñµ¥¹ØÁªÐÅÏ¢ private void SetBillRelationInfo() { if (AllowRow() == false) { return; } DBUtility.Xt_BaseBillFun.initGridList(grdSource_SeSub, this.Name + "grdSource_SeSub"); //µÃµ½¿â´æ ClsCN SubCn = new ClsCN(); DataSet DSet; //ÏÔʾ±¨±íÍ· ±êÌâ string HAreaName = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HAreaNameCol].Value); string HModel = DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HModelCol].Value); long HWhID = DBUtility.ClsPub.isLong(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[HWhIDCol].Value); if (HWhID == 0) { grdSource_SeSub.DataSource = null; return; } //¹ýÂËÌõ¼þDlg string sDlgWhere = ""; sDlgWhere = sDlgWhere + "," + HWhID.ToString(); sDlgWhere = sDlgWhere + ",'" + HModel + "'"; sDlgWhere = sDlgWhere + ",'" + HAreaName + "'"; if (sDlgWhere.Trim().Length > 0) { sDlgWhere = sDlgWhere.Substring(1, sDlgWhere.Length - 1); } // DSet = SubCn.RunProcReturn("exec h_p_KF_ICInventoryList_RG " + sDlgWhere, "h_p_KF_ICInventoryList_RG"); //Éú³ÉÊ×ÐбêÌâ if (DSet == null) { MessageBox.Show("ûÓзµ»ØÈκνá¹û,³¢ÊÔÔٴβéѯ£¡" + DBUtility.ClsPub.sExeReturnInfo); grdSource_SeSub.DataSource = null; return; } // grdSource_SeSub.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(grdSource_SeSub, this.Name + "grdSource_SeSub", "ÊÇ", 0); // DBUtility.Xt_BaseBillFun.GetGrid(grdSource_SeSub, this.Name + "grdSource_SeSub"); //Total(); } private Int32 Fun_GetCol_SourceBill(string sCol) { return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_SeOrder); } private Int32 Fun_GetCol_Source(string sCol) { return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_SeSub); } private Int32 Fun_GetCol_Main(string sCol) { return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdSource_ICMO); } private void grdSourceBill_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { int i = grdSource_SeOrder.CurrentCell.ColumnIndex; if (i < HFixCol && i!= HPCQtyCol) { e.Cancel = true; } } DataGridViewTextBoxEditingControl EditingControl; private void grdSourceBill_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (this.EditingControl != null) //ÊÍ·Åʼþ { EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown); this.EditingControl = null; } } private void EditingControl_KeyDown(object sender, KeyEventArgs e) { //ÒµÎñ´¦Àí Sub_GridKey(e.KeyValue, grdSource_SeOrder.CurrentRow.Index, grdSource_SeOrder.CurrentCell.ColumnIndex, EditingControl); } private void grdSourceBill_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (grdSource_SeOrder.CurrentCell != null) { if (e.Control is DataGridViewTextBoxEditingControl) { this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control; //Ôö¼ÓίÍд¦Àí this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown); } } } private void grdSourceBill_CellClick(object sender, DataGridViewCellEventArgs e) { SetBillRelationInfo(); } private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e) { } private void grdSourceBill_KeyDown(object sender, KeyEventArgs e) { Sub_GridKey(e.KeyValue, grdSource_SeOrder.CurrentRow.Index, grdSource_SeOrder.CurrentCell.ColumnIndex, EditingControl); } private void xs_Click(object sender, EventArgs e) { } private void grdSourceBill_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (DBUtility.ClsPub.isStrNull(grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value) == "¡Ì") { grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value = ""; } else { grdSource_SeOrder.Rows[grdSource_SeOrder.CurrentCell.RowIndex].Cells[selectcol].Value = "¡Ì"; } } private void cmdHCusID_Click(object sender, EventArgs e) { DAL.ClsK3_Customer_View oCust = new DAL.ClsK3_Customer_View(); if (oCust.RefreshView()) { this.txtHCusID.Text = oCust.oModel.HName; this.txtHCusID.Tag = oCust.oModel.HItemID.ToString(); } else { this.txtHCusID.Text = ""; } } private void pc_Click(object sender, EventArgs e) { Sub_CheckBill(); } private void Sub_CheckBill() { DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3(); //±£´æµ±Ç°Ñ¡ÔñÐÐ if (grdSource_ICMO.CurrentRow == null) { return; } //»ñÈ¡ÈÎÎñµ¥ÄÚÂë BillNew.omodel.HInterID = DBUtility.ClsPub.isLong(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); if (BillNew.CheckICMOBill(BillNew.omodel.HInterID,ref DBUtility.ClsPub.sExeReturnInfo)) { //Éú³ÉÁ÷ת¿¨ // MessageBox.Show("ÈÎÎñµ¥Ï´ï³É¹¦£¡"); } else { MessageBox.Show("Ï´ïʧ°Ü£¡" + DBUtility.ClsPub.sExeReturnInfo); } } private void grdMain_DoubleClick(object sender, EventArgs e) { int selectcol = Fun_GetCol_Main("Ñ¡Ôñ"); if (DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value) == "¡Ì") { grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value = ""; } else { grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[selectcol].Value = "¡Ì"; } } 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(ClsPub.AppPath + @"\" + sOpenTmp + ".grf"); //here . // Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); } //¸³Öµ±íÍ· private void ReportBeforePostRecord()// { try { // Report.FieldByName("¶©µ¥ÀàÐÍ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ÀàÐÍ")].Value); Report.FieldByName("Ï´ïÈÕÆÚ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Ï´ïÈÕÆÚ")].Value); Report.FieldByName("°ü×°·½Ê½").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("°ü×°·½Ê½")].Value); Report.FieldByName("¿Í»§").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¿Í»§")].Value); Report.FieldByName("ºÏͬÅúºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ºÏͬÅúºÅ")].Value); Report.FieldByName("½»»õÈÕÆÚ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("½»»õÈÕÆÚ")].Value); Report.FieldByName("¶©µ¥ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ºÅ")].Value); Report.FieldByName("±íÍ·±¸×¢").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("±íÍ·±¸×¢")].Value); Report.FieldByName("±íÉí±¸×¢").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("±íÉí±¸×¢")].Value); Report.FieldByName("Åä·½ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Åä·½ºÅ")].Value); Report.FieldByName("¯ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¯ºÅ")].Value); Report.FieldByName("¹¤ÒÕ·Ïß").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¹¤ÒÕ·Ïß")].Value); Report.FieldByName("À­Ë¿Ö±¾¶1").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶1")].Value); Report.FieldByName("À­Ë¿Ö±¾¶2").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶2")].Value); Report.FieldByName("À­Ë¿Ö±¾¶3").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿Ö±¾¶3")].Value); Report.FieldByName("·¢Áϲֿâ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("·¢Áϲֿâ")].Value); Report.FieldByName("¸Ö²Ä²úµØ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¸Ö²Ä²úµØ")].Value); Report.FieldByName("Çò»¯Â¯ºÅ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("Çò»¯Â¯ºÅ")].Value); Report.FieldByName("²ÄÖÊ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("²ÄÖÊ")].Value); Report.FieldByName("ëÁϹæ¸ñ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ëÁϹæ¸ñ")].Value); Report.FieldByName("¶©µ¥¾íÊý").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥¾íÊý")].Value); Report.FieldByName("¶©µ¥ÖØÁ¿").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("¶©µ¥ÖØÁ¿")].Value); Report.FieldByName("³ÉÆ·¹æ¸ñ").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("³ÉÆ·¹æ¸ñ")].Value); Report.FieldByName("³ÉÆ·±ê×¼").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("³ÉÆ·±ê×¼")].Value); Report.FieldByName("À­Ë¿·½Ïò").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("À­Ë¿·½Ïò")].Value); Report.FieldByName("ÌØÊâÒªÇó1").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÌØÊâÒªÇó1")].Value); Report.FieldByName("ÌØÊâÒªÇó2").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÌØÊâÒªÇó2")].Value); Report.FieldByName("ÖÆµ¥ÈË").AsString = DBUtility.ClsPub.isStrNull(grdSource_ICMO.Rows[grdSource_ICMO.CurrentRow.Index].Cells[Fun_GetCol_Main("ÖÆµ¥ÈË")].Value); } catch (Exception e) { MessageBox.Show("´òӡʧ°Ü!±íÍ·£º" + e.Message); } } //¸³Öµ±íÌå private void ReportFetchRecordByDataTable() { try { DataTable dt = new DataTable(); BLL.Utility.FillRecordToReport_FstRow(Report, grdSource_ICMO, dt, 0); } catch (Exception e) { MessageBox.Show("´òӡʧ°Ü!±íÌ壺" + e.Message); } } private void sc_Click(object sender, EventArgs e) { Sub_DeleteBill(); } private void Sub_DeleteBill() { DAL.ClsSc_ICMOBill_K3 BillNew = new DAL.ClsSc_ICMOBill_K3(); //±£´æµ±Ç°Ñ¡ÔñÐÐ if (grdSource_ICMO.CurrentRow == null) { return; } //»ñÈ¡ÈÎÎñµ¥ÄÚÂë BillNew.omodel.HInterID = DBUtility.ClsPub.isLong(grdSource_ICMO.Rows[grdSource_ICMO.CurrentCell.RowIndex].Cells[HICMOInterIDCol].Value); if (BillNew.DeleteBill(BillNew.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) { MessageBox.Show("ÈÎÎñµ¥É¾³ý³É¹¦£¡"); } else { MessageBox.Show("ɾ³ýʧ°Ü£¡" + DBUtility.ClsPub.sExeReturnInfo); } } } }