From dc12599a63e5e207f98667bc552a58dffee5498f Mon Sep 17 00:00:00 2001
From: yxj <yxj@hz-kingdee.com>
Date: 星期三, 26 七月 2023 20:45:31 +0800
Subject: [PATCH] 新增网页版条码库存查询、WMS物料出入库记录、WMS物料库存查询报表模块调用方法
---
WarM/条码打印/Gy_BarCodeBillList.cs | 969 +++++++++++++++++++++++++++-----------------------------
1 files changed, 467 insertions(+), 502 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..0d742fb 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,34 @@
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 = ""; //瓒呮簮鍗曟暟閲忔帶鍒�
+ public string CampanyName = ""; //瀹㈡埛瀹氬埗鍖栧悕绉�
- 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 +70,15 @@
PrintQty = oSystemParameter.omodel.BarCode_PrintQty;
PrintQtyCtl = oSystemParameter.omodel.BarCode_PrintQtyCtl;
UpdatePrintQtyCtl = oSystemParameter.omodel.BarCode_UpdatePrintQtyCtl;
+ SourceQtyCtl = oSystemParameter.omodel.BarCode_SourceQtyCtl;
+ CampanyName = oSystemParameter.omodel.WMS_CampanyName;
}
}
- 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 +94,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 +111,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 +496,7 @@
}
sBarCodeItemID = sBarCodeItemID.Remove(0, 1);
- if (PrintQtyCtl=="Y")
+ if (PrintQtyCtl == "Y")
{
if (oBar.Set_CheckPrintQty(sBarCodeItemID, PrintQty, ref sHRemark))
{
@@ -526,24 +538,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,37 +569,118 @@
}
}
+ #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)
+ 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
+
+
+ #region 閫�鍑哄姛鑳�
+
+ private void tc_Click(object sender, EventArgs e)
+ {
+ this.Close();
+ }
+
+
+
+
+
+
+
+
+
+
+ #endregion
+
+
+ #region 缁戝畾鎵樻潯鐮�
+ private void bdBarCode_Pack_Click(object sender, EventArgs e)
+ {
+ if (grdMain.CurrentRow == null)
{
- //
+ MessageBox.Show("璇峰厛閫夋嫨闇�瑕佺粦瀹氱殑鏉$爜锛�", "鎻愮ず");
+ return;
+ }
+ else
+ {
+ Int64 hmainid = 0;
+ string HItemID = "";
+ string s = "";
+ string HBarCode_Pack = "";
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)
+ if (s.Length > 4500)
{
+ HItemID = HItemID + "#" + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+ s = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
}
else
{
- oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i + 1].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
+ HItemID = HItemID + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+ s = s + "," + DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
}
- Thread.Sleep(1000);
- i++;
+
+ //鑾峰彇鎵樻潯鐮佸彿锛氭墭鏉$爜=鎵�閫夋潯鐮佷腑娴佹按鍙锋渶澶х殑鏉$爜+鈥�-1鈥�
+ if (hmainid<DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString()))
+ {
+ hmainid = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("hmainid")].Value.ToString());
+ HBarCode_Pack = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value) + "-1";
+ }
+ }
+
+ try
+ {
+ oCn.BeginTran();
+ Int64 HFlag = 0;
+ HItemID = HItemID.Remove(0, 1); //鍘绘帀瀛楃涓茬涓�涓瓧绗�
+ string[] NewHItemID;
+ NewHItemID = HItemID.Split(Convert.ToChar("#"));
+
+ for (int i = 0; i <= NewHItemID.Length - 1; i++)
+ {
+ if(i == NewHItemID.Length - 1)
+ {
+ HFlag = 1;
+ }
+ //鎵樻潯鐮佺粦瀹氬墠鍒ゆ柇锛屽洖濉墭鏉$爜淇℃伅锛岀敓鎴愭墭鏉$爜
+ DataSet DS = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_BindPack '" + NewHItemID[i] + "','" + HBarCode_Pack + "','" + CampanyName + "'," + HFlag + ",'" + DBUtility.ClsPub.CurUserName + "'", "h_p_Gy_BarCodeBill_BindPack");
+ if (DS == null || DS.Tables[0].Rows.Count <= 0)
+ {
+ oCn.CnClose();
+ oCn.CnDispose();
+ MessageBox.Show("缁戝畾骞剁敓鎴愭墭鏉$爜鍒ゆ柇閿欒锛�");
+ return;
+ }
+ else if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+ {
+ oCn.CnClose();
+ oCn.CnDispose();
+ MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
+ return;
+ }
+ }
+
+ MessageBox.Show("缁戝畾骞剁敓鎴愭墭鏉$爜鎴愬姛锛�", "鎻愮ず");
+ Display();
+ oCn.Commit();
+ }
+ catch (Exception e2)
+ {
+ oCn.RollBack();
+ throw (e2);
}
}
}
@@ -608,160 +688,45 @@
#endregion
- //
- private void grdMain_Paint(object sender, PaintEventArgs e)
+ #region 瑙g粦鎵樻潯鐮�
+ private void jbBarCode_Pack_Click(object sender, EventArgs e)
{
- GraphicsGrid();
- }
-
- 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)
{
+ MessageBox.Show("璇峰厛閫夋嫨闇�瑕佽В缁戠殑鏉$爜锛�", "鎻愮ず");
return;
}
- for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+ if (grdMain.SelectedRows.Count != 1)
{
- if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0)
+ MessageBox.Show("涓�娆″彧鍏佽閫変腑涓�琛屾潯鐮佽褰曪紝璇烽噸鏂伴�夋嫨闇�瑕佽В缁戠殑鏉$爜锛�");
+ return;
+ }
+ else
+ {
+ Int64 HItemID = 0;
+ HItemID = DBUtility.ClsPub.isLong(grdMain.SelectedRows[0].Cells[Fun_GetCol("hmainid")].Value);
+
+ //鎵樻潯鐮佽В缁戝墠鍒ゆ柇锛屽洖濉墭鏉$爜淇℃伅锛屽垹闄ゆ墭鏉$爜
+ DataSet DS = oCn.RunProcReturn("exec h_p_Gy_BarCodeBill_UnBindPack " + HItemID + ",'" + CampanyName + "'", "h_p_Gy_BarCodeBill_UnBindPack");
+ if (DS == null || DS.Tables[0].Rows.Count <= 0)
{
- if (!oBar.Cancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)))
- {
- MessageBox.Show("浣滃簾澶辫触锛�", "鎻愮ず");
- return;
- }
+ MessageBox.Show("瑙g粦骞跺垹闄ゆ墭鏉$爜鍒ゆ柇閿欒锛�");
+ return;
+ }
+ else if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0][0]) == "1")
+ {
+ MessageBox.Show(DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["HRemark"]));
+ return;
+ }
+ else
+ {
+ MessageBox.Show("瑙g粦骞跺垹闄ゆ墭鏉$爜鎴愬姛锛�", "鎻愮ず");
+ Display();
}
}
- 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