From a24146dbb442e09daca1d0a901c55632a176ec6d Mon Sep 17 00:00:00 2001 From: ch <37327@LLOOCCY> Date: 星期一, 30 五月 2022 13:36:25 +0800 Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API --- WarM/条码打印/Gy_BarCodeBillList.cs | 866 +++++++++++++++++++++++---------------------------------- 1 files changed, 352 insertions(+), 514 deletions(-) diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" index f9f460f..28c328d 100644 --- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" +++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBillList.cs" @@ -25,123 +25,33 @@ public string ModCaption = "鏉$爜妗f鍒楄〃"; public const string ModName = "3302"; public const string ModRightName = "Gy_BarCodeBillList"; - 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 const string ModRightNameEdit = ModRightName + "_Edit"; //鍒犻櫎 + public const string ModRightNameDelete = ModRightName + "_Delete"; //浣滃簾 public const string ModRightNamePrint = ModRightName + "_Print"; //鎵撳嵃 - //DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill(); - //public Gy_ICBomBill oFrm; + + DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public int selectRow = 0; public int selectRow2 = 0; public long PrintQty = 0; //鍏佽鏉$爜鎵撳嵃娆℃暟 public string PrintQtyCtl = ""; //鏉$爜鎵撳嵃娆℃暟鎺у埗 public string UpdatePrintQtyCtl = ""; //鏉$爜鎵撳嵃娆℃暟鏇存柊 - // - private void initGrid() - { - DBUtility.Xt_BaseBillFun.initGridList(grdMain,this.Name); - } - // + public string SourceQtyCtl = ""; //瓒呮簮鍗曟暟閲忔帶鍒� - private void Display() - { - ClsCN SubCn = new ClsCN(); - DataSet DSet; - string sSql = ""; - string sWhere = ""; - //杩囨护鏉′欢 - if (frmCondition.SqlStr.Trim().Length == 0) - return; - sSql = frmCondition.SqlStr + sWhere + " order by 鏉$爜缂栧彿 "; - // - DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo); - //鐢熸垚棣栬鏍囬 - if (DSet == null) - { - MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo); - return; - } - // - grdMain.DataSource = DSet.Tables[0].DefaultView; - //鍐荤粨 - int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text); - string s = frmCondition.cmbHComplete.Text; - DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s,FrCol); - //鐢荤嚎 - GraphLine(); - - - // - } + #region 鍥哄畾浠g爜 - // - 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() - { - //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.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill(); - //if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) - //{ - // oFrm = new Gy_ICBomBill(); - // oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View; - // oFrm.BillOld = oBill; - // oFrm.ShowDialog(); - // if (oFrm.BillChange) - // { - // if (MessageBox.Show("鍗曟嵁鍒楄〃宸茬粡鍙戠敓鍙樺寲,鏄惁鍒锋柊", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) - // { - // timer1.Enabled = true; - // } - // } - //} - //else - //{ - // MessageBox.Show("鍗曟嵁鏈壘鍒�", "鎻愮ず"); - //} - //oBill = null; - } - // - private Int32 Fun_GetCol(string sCol) - { - return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain); - } - // private void Gy_BarCodeBillList_Load(object sender, EventArgs e) { - // frmCondition = new frmBillQueryCondition_New(); this.Text = ModCaption; lblCaption.Text = ModCaption; initGrid(); Sub_GetSystemParameter(); + } + + private void initGrid() + { + DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name); } //鑾峰彇绯荤粺鍙傛暟淇℃伅 @@ -159,119 +69,14 @@ PrintQty = oSystemParameter.omodel.BarCode_PrintQty; PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl; UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl; + SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl; } } - private void grdMain_DblClick(object sender, EventArgs e) + private void timer1_Tick(object sender, EventArgs e) { - Sub_ShowBill(); - } - - private void cx_Click(object sender, EventArgs e) - { - frmCondition = new frmBillQueryCondition_New(); - SetCondition(frmCondition, ViewName, this.Name); - frmCondition.ShowDialog(); - if (frmCondition.Tag.ToString() == "OK") - { - Display(); - } - } - - public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name) - { - frmCondition.Tag = ""; - frmCondition.ViewName = ViewName; - frmCondition.ModName = Name; - } - - private void xz_Click(object sender, EventArgs e) - { - // - //oFrm = new Gy_ICBomBill(); - //oFrm.ShowDialog(); - } - - 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.ClsGy_BarCodeBill_View oBill = new DAL.ClsGy_BarCodeBill_View(); - //DAL.ClsGy_BarCodeBill_Ctl oBillC = new DAL.ClsGy_BarCodeBill_Ctl(); - //if (oBill.GetInfoByID(lngBillKey)) - //{ - // if (MessageBox.Show("纭畾瑕佸垹闄ゅ綋鍓嶅崟鎹紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.OK) - // { - // if (!oBillC.DeleteByID(lngBillKey)) - // { - // MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - // return; - // } - // else - // { - // Display(); - // } - - // } - //} - //else - //{ - // MessageBox.Show("鍗曟嵁鏈壘鍒�", "鎻愮ず"); - //} - - Int64 lngBillKey = 0; - if (grdMain.CurrentRow == null) - return; - if (MessageBox.Show("纭畾瑕佸垹闄ゆ墍閫夊崟鎹紵", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) - { - for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) - { - lngBillKey = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value); - if (lngBillKey == 0) - return; - DAL.ClsGy_BarCodeBill_View oBill = new DAL.ClsGy_BarCodeBill_View(); - DAL.ClsGy_BarCodeBill_Ctl oBillC = new DAL.ClsGy_BarCodeBill_Ctl(); - if (oBill.GetInfoByID(lngBillKey)) - { - try - { - oBillC.DeleteByID(lngBillKey); - } - catch (Exception ex) - { - MessageBox.Show("鍒犻櫎澶辫触锛屾潯鐮�" + grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value + "宸茶浣跨敤", "鎻愮ず"); - Display(); - return; - } - if (oBillC.DeleteByID(lngBillKey) != true) - { - MessageBox.Show("鍒犻櫎澶辫触,鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - return; - } - } - else - { - MessageBox.Show("鍗曟嵁鏈壘鍒帮紒", "鎻愮ず"); - return; - } - } - } - MessageBox.Show("鍒犻櫎鎴愬姛锛�", "鎻愮ず"); + timer1.Enabled = false; + initGrid(); Display(); } @@ -287,124 +92,16 @@ } } - - - private void bclk_Click(object sender, EventArgs e) + public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name) { - //淇濆瓨鍒楀 - DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name); + frmCondition.Tag = ""; + frmCondition.ViewName = ViewName; + frmCondition.ModName = Name; } - private void mrlk_Click(object sender, EventArgs e) + private void grdMain_Paint(object sender, PaintEventArgs 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 sh_Click(object sender, EventArgs e) - { - this.Sub_CheckBill(); - } - - //瀹℃牳鍗曟嵁 - private void Sub_CheckBill() - { - //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 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.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill(); - //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 - if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) - { - if (oBill.omodel.HChecker.Trim() != "") - { - MessageBox.Show("鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳", "鎻愮ず"); - return; - } - } - else - { - MessageBox.Show("鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - return; - } - //瀹℃牳 - if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) - { - MessageBox.Show("瀹℃牳鎴愬姛!", "鎻愮ず"); - return; - } - else - { - MessageBox.Show("瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - return; - } - } - //鍙嶅鍗曟嵁 - private void Sub_AbandonCheck() - { - //瀹℃牳鏉冮檺 - if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 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.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill(); - //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾 - if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) - { - if (oBill.omodel.HChecker.Trim() == "") - { - MessageBox.Show("鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!", "鎻愮ず"); - return; - } - } - else - { - MessageBox.Show("鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - return; - } - //鍙嶅鏍� - if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true) - { - MessageBox.Show("鍙嶅鏍告垚鍔�!", "鎻愮ず"); - return; - } - else - { - MessageBox.Show("鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); - return; - } - } - //鍙嶅鏍� - private void qsh_Click(object sender, EventArgs e) - { - Sub_AbandonCheck(); + GraphicsGrid(); } private void GraphicsGrid() @@ -412,7 +109,320 @@ DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain); } - #region //鎵撳嵃璁剧疆 + private Int32 Fun_GetCol(string sCol) + { + return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain); + } + + //淇濆瓨鍒楀 + 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); + } + + #endregion + + + #region 鏌ヨ鍔熻兘 + + private void cx_Click(object sender, EventArgs e) + { + frmCondition = new frmBillQueryCondition_New(); + SetCondition(frmCondition, ViewName, this.Name); + frmCondition.ShowDialog(); + if (frmCondition.Tag.ToString() == "OK") + { + Display(); + } + } + + private void Display() + { + ClsCN SubCn = new ClsCN(); + DataSet DSet; + string sSql = ""; + string sWhere = ""; + //杩囨护鏉′欢 + if (frmCondition.SqlStr.Trim().Length == 0) + return; + sSql = frmCondition.SqlStr + sWhere + " order by HItemID desc "; + // + DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo); + //鐢熸垚棣栬鏍囬 + if (DSet == null) + { + MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo); + return; + } + // + grdMain.DataSource = DSet.Tables[0].DefaultView; + //鍐荤粨 + int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text); + string s = frmCondition.cmbHComplete.Text; + DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol); + //鐢荤嚎 + GraphLine(); + } + + 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() + " 鏉¤褰�"; + } + + #endregion + + + #region 鍒锋柊鍔熻兘 + + private void sx_Click(object sender, EventArgs e) + { + timer1.Enabled = true; + } + + #endregion + + + #region 鍒犻櫎鍔熻兘 + + //鍗曟潯鍒犻櫎 + 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; + } + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佸垹闄ょ殑鏉$爜锛�", "鎻愮ず"); + return; + } + if (grdMain.SelectedRows.Count != 1) + { + MessageBox.Show("涓嶅厑璁稿琛屽垹闄わ紝璇烽噸鏂伴�夋嫨瑕佸垹闄ょ殑鏉$爜锛�"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佸垹闄ゆ墍閫夋潯鐮侊紵鍒犻櫎鍚庝笉鑳芥仮澶嶏紝璇疯皑鎱庢搷浣滐紒", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + Int64 HItemID = 0; + string HBarCode = ""; + HItemID = DBUtility.ClsPub.isLong(grdMain.SelectedRows[0].Cells[Fun_GetCol("hmainid")].Value); + HBarCode = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[0].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + + if (!oBar.DeleteBill(HItemID, HBarCode, ref DBUtility.ClsPub.sExeReturnInfo)) + { + MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); + return; + } + else + { + MessageBox.Show("鍒犻櫎鎴愬姛锛�", "鎻愮ず"); + Display(); + } + } + } + } + + //鎵归噺鍒犻櫎 + private void ps_Click(object sender, EventArgs e) + { + Sub_MulDeleteBill(); + } + + private void Sub_MulDeleteBill() + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName)) + { + return; + } + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佸垹闄ょ殑鏉$爜锛�", "鎻愮ず"); + return; + } + if (grdMain.SelectedRows.Count > 300) + { + MessageBox.Show("鎵归噺鍒犻櫎鏉$爜閫変腑琛屾暟涓嶈兘瓒呰繃300琛岋紒", "鎻愮ず"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佹壒閲忓垹闄ゆ墍閫夋潯鐮侊紵鍒犻櫎鍚庝笉鑳芥仮澶嶏紝璇疯皑鎱庢搷浣滐紒", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) + { + string HItemID = ""; + string HBarCode = ""; + for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) + { + HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); + if (i != 0 && i % 100 == 0) + { + HBarCode = HBarCode + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + else + { + HBarCode = HBarCode + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + } + + HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗� + HBarCode = HBarCode.Remove(0, 1); + if (!oBar.MulDeleteBill(HItemID, HBarCode, ref DBUtility.ClsPub.sExeReturnInfo)) + { + MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); + return; + } + else + { + MessageBox.Show("鎵归噺鍒犻櫎鎴愬姛锛�", "鎻愮ず"); + Display(); + } + } + } + } + + #endregion + + + #region 浣滃簾鍔熻兘 + + private void zf_Click(object sender, EventArgs e) + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName)) + { + return; + } + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佷綔搴熺殑鏉$爜锛�", "鎻愮ず"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佷綔搴熸墍閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + else + { + string HItemID = ""; + string HBarCode = ""; + for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) + { + HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); + if (i != 0 && i % 100 == 0) + { + HBarCode = HBarCode + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + else + { + HBarCode = HBarCode + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + } + + HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗� + HBarCode = HBarCode.Remove(0, 1); + if (!oBar.Cancelltion(HItemID, HBarCode, DBUtility.ClsPub.CurUserName)) + { + MessageBox.Show("浣滃簾澶辫触锛�", "鎻愮ず"); + return; + } + else + { + MessageBox.Show("浣滃簾鎴愬姛锛�", "鎻愮ず"); + Display(); + } + } + } + } + + #endregion + + + #region 鍙嶄綔搴熷姛鑳� + + private void fzf_Click(object sender, EventArgs e) + { + //鍒ゆ柇鏉冮檺 + if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName)) + { + return; + } + if (grdMain.CurrentRow == null) + { + MessageBox.Show("璇峰厛閫夋嫨闇�瑕佸弽浣滃簾鐨勬潯鐮侊紒", "鎻愮ず"); + return; + } + if (grdMain.SelectedRows.Count>300) + { + MessageBox.Show("鍚屾椂鍙嶄綔搴熸潯鐮侀�変腑琛屾暟涓嶈兘瓒呰繃300琛岋紒", "鎻愮ず"); + return; + } + else + { + if (MessageBox.Show("纭畾瑕佸弽浣滃簾鎵�閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) + { + return; + } + else + { + string HItemID = ""; + string HBarCode = ""; + for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) + { + HItemID = HItemID + "," + DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()); + if (i != 0 && i % 100 == 0) + { + HBarCode = HBarCode + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + else + { + HBarCode = HBarCode + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value); + } + } + + HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗� + HBarCode = HBarCode.Remove(0, 1); + if (!oBar.UnCancelltion(HItemID, HBarCode, SourceQtyCtl, ref DBUtility.ClsPub.sExeReturnInfo)) + { + MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず"); + return; + } + else + { + MessageBox.Show("鍙嶄綔搴熸垚鍔燂紒", "鎻愮ず"); + Display(); + } + } + } + } + + #endregion + + + #region 鎵撳嵃璁剧疆 GridppReport Report; int CurRows = 0; @@ -484,7 +494,7 @@ } sBarCodeItemID = sBarCodeItemID.Remove(0, 1); - if (PrintQtyCtl=="Y") + if (PrintQtyCtl == "Y") { if (oBar.Set_CheckPrintQty(sBarCodeItemID, PrintQty, ref sHRemark)) { @@ -526,24 +536,11 @@ //Report.FieldByName("鐗╂枡浠g爜").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value.ToString(); //Report.FieldByName("鐗╂枡鍚嶇О").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value.ToString(); //Report.FieldByName("瑙勬牸鍨嬪彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value.ToString(); - ////Report.FieldByName("鑷畾涔夎鏍�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鑷畾涔夎鏍�")].Value.ToString(); - //Report.FieldByName("鏉$爜缂栧彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value.ToString(); - //Report.FieldByName("鏁伴噺").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鏁伴噺")].Value.ToString(); - //Report.FieldByName("鎵规").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎵瑰彿")].Value.ToString(); - //Report.FieldByName("婧愬崟鍗曞彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("婧愬崟鍗曞彿")].Value.ToString(); - //Report.FieldByName("閿�鍞鍗曞彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("閿�鍞鍗曞彿")].Value.ToString(); - //Report.FieldByName("閲囪喘璁㈠崟鍙�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("閲囪喘璁㈠崟鍙�")].Value.ToString(); - //Report.FieldByName("渚涘簲鍟�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("寰�鏉ュ崟浣�")].Value.ToString(); - //Report.FieldByName("鐢熶骇杞﹂棿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐢熶骇杞﹂棿")].Value.ToString(); - //Report.FieldByName("澶囨敞").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("澶囨敞")].Value.ToString(); - //Report.FieldByName("鎬绘墭鏁�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎬绘墭鏁�")].Value.ToString(); - //Report.FieldByName("鎵樺彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎵樺彿")].Value.ToString(); } catch (Exception e) { MessageBox.Show("鎵撳嵃澶辫触!琛ㄥご锛�" + e.Message); } - //CurRows = CurRows + 1; } //濉叆鍗曟嵁琛ㄤ綋淇℃伅 @@ -570,198 +567,39 @@ } } + #endregion - //杩炴墦 - private void dy2_Click(object sender, EventArgs e) + #region 寮曞嚭鍔熻兘 + + private void eXCELToolStripMenuItem_Click(object sender, EventArgs e) { - //閫夋嫨鎵撳嵃妯℃澘 - BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp(); - DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); - oFrm.sBillName = ModName; - oFrm.sBillModel = ModCaption; - oFrm.ShowDialog(); - if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) - { - // - for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) - { - selectRow = i; - selectRow2 = i + 1; - Sub_SetReport(oFrm.sOpenTmp); - Report.Print(false); - oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)); - // - if (selectRow2 > grdMain.SelectedRows.Count - 1) - { - } - else - { - oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i + 1].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)); - } - Thread.Sleep(1000); - i++; - } - } + DBUtility.Gy_BaseFun.DataToExcel(this.Text, grdMain); + } + + private void cSVToolStripMenuItem_Click(object sender, EventArgs e) + { + DBUtility.Gy_BaseFun.DataGridViewToExcel2(grdMain, this.Text, this.Text); } #endregion - // - private void grdMain_Paint(object sender, PaintEventArgs e) + #region 閫�鍑哄姛鑳� + + private void tc_Click(object sender, EventArgs e) { - GraphicsGrid(); + this.Close(); } - private void yc_Click(object sender, EventArgs e) - { - DataGridViewToExcel2(grdMain, this.Text, this.Text); - } - /// <summary> - /// 缃戞牸 瀵煎嚭EXCEL 缃戞牸锛屾枃浠跺悕锛屾爣棰樺悕 - /// </summary> - public static void DataGridViewToExcel2(DataGridView grdMain, string sText, string sBTText) - { - SaveFileDialog saveFileDialog = new SaveFileDialog(); - saveFileDialog.Filter = "Execl鏂囦欢(*.xls)|*.xls"; - saveFileDialog.FilterIndex = 0; - saveFileDialog.RestoreDirectory = true; - saveFileDialog.CreatePrompt = true; - saveFileDialog.Title = "鏁版嵁瑙嗗浘瀵煎嚭EXCEL鏂囦欢"; - saveFileDialog.FileName = sText; - //saveFileDialog.ShowDialog(); - if (saveFileDialog.ShowDialog() == DialogResult.OK) - { - Stream myStream; - myStream = saveFileDialog.OpenFile(); - StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding("gb2312")); - string str = ""; - DateTime start = DateTime.Now; - try - { - if (sBTText != "") - { - sw.WriteLine(sBTText); - } - //鍐欐爣棰� - bool sFirstCol = true; - for (int i = 0; i < grdMain.ColumnCount; i++) - { - if (i > 0 && grdMain.Columns[i].HeaderText.Substring(0, 1) != "h" && grdMain.Columns[i].HeaderText.Substring(0, 1) != "H" && sFirstCol != true) - { - str += "\t"; - } - if (grdMain.Columns[i].HeaderText.Substring(0, 1) != "h" && grdMain.Columns[i].HeaderText.Substring(0, 1) != "H") - { - sFirstCol = false; - str += grdMain.Columns[i].HeaderText; - } - } - str = str.Replace("\n", ""); - sw.WriteLine(str); - //鍐欏唴瀹� - for (int j = 0; j < grdMain.Rows.Count; j++) - { - string tempStr = ""; - sFirstCol = true; - for (int k = 0; k < grdMain.Columns.Count; k++) - { - if (k > 0 && grdMain.Columns[k].HeaderText.Substring(0, 1) != "h" && grdMain.Columns[k].HeaderText.Substring(0, 1) != "H" && sFirstCol != true) - { - tempStr += "\t"; - } - if (grdMain.Columns[k].HeaderText.Substring(0, 1) != "h" && grdMain.Columns[k].HeaderText.Substring(0, 1) != "H") - { - sFirstCol = false; - if (grdMain.Rows[j].Cells[k].Value == null) - { - tempStr += string.Empty; - } - else - { - tempStr += grdMain.Rows[j].Cells[k].Value.ToString(); - } - } - } - tempStr = tempStr.Replace("\n", ""); - sw.WriteLine(tempStr); - } - sw.Close(); - myStream.Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - } - finally - { - sw.Close(); - myStream.Close(); - } - MessageBox.Show("灏嗘宸ヤ綔琛ㄥ鍑轰负excel鍏辫�楁椂锛�" + DateTime.Now.Subtract(start).TotalMilliseconds.ToString() + "姣"); - } - } - private void zf_Click(object sender, EventArgs e) - { - //Sub_AbandonCheck(); - if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName)) - { - return; - } - if (grdMain.CurrentRow == null) - return; - DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); - if (MessageBox.Show("纭畾瑕佷綔搴熸墍閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - { - return; - } - for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) - { - if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0) - { - if (!oBar.Cancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value))) - { - MessageBox.Show("浣滃簾澶辫触锛�", "鎻愮ず"); - return; - } - } - } - MessageBox.Show("浣滃簾鎴愬姛锛�", "鎻愮ず"); - } - private void fzf_Click(object sender, EventArgs e) - { - //this.Sub_CheckBill(); - if (!DBUtility.ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName)) - { - return; - } - if (grdMain.CurrentRow == null) - return; - DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl(); - if (MessageBox.Show("纭畾瑕佸弽浣滃簾鎵�閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel) - { - return; - } - for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++) - { - if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0) - { - if (!oBar.UnCancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value))) - { - MessageBox.Show("鍙嶄綔搴熷け璐ワ紒", "鎻愮ず"); - return; - } - } - } - MessageBox.Show("鍙嶄綔搴熸垚鍔燂紒", "鎻愮ず"); - } + #endregion + -- Gitblit v1.9.1