| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Windows.Forms; |
| | | using Microsoft.VisualBasic; |
| | | |
| | | namespace WarM.æ¡ç æå° |
| | | { |
| | |
| | | public bool BillChange; // |
| | | public bool grdStatus; |
| | | public int selectRow = 0; |
| | | |
| | | //è®°å½å½åç»æçæ¡ç çæºåIDãåIDï¼ç¨äºä¿è¯å½åæä¸ææåæ¡ç 为åä¸ä¸ªå·¥åçæ |
| | | public int HSourceInterID_ICMO = 0; |
| | | public int HSourceEntryID_ICMO = 0; |
| | | |
| | | private void Gy_PackBarCodeBill_automaticallyByPLC_Load(object sender, EventArgs e) |
| | | { |
| | |
| | | DBUtility.Xt_BaseBillFun.initGridList(grdSub, this.Name + "grdSub"); |
| | | |
| | | getDisplay_GrdMain(); |
| | | |
| | | if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value!=null) |
| | | { |
| | | getPackQty(grdMain.Rows[0].Cells[4].Value.ToString()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return; |
| | | } |
| | | this.Sub_SaveBill(); |
| | | }catch(Exception ex) |
| | | |
| | | //ç»ææååï¼æ¸
ç©ºç»ææ°é䏿ºåä¿¡æ¯ |
| | | set_clearPackQtyAndSourceInfo(); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | MessageBox.Show(ex.Message); |
| | | } |
| | |
| | | //èªå¨ç»æ |
| | | private void button_startListen_Click(object sender, EventArgs e) |
| | | { |
| | | if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0) |
| | | { |
| | | MessageBox.Show("è¯·è®¾ç½®ææ¡ç çæå°å
è£
æ°ï¼"); |
| | | return; |
| | | } |
| | | //if (DBUtility.ClsPub.isLong(textBox_PackQty.Text) == 0) |
| | | //{ |
| | | // MessageBox.Show("è¯·è®¾ç½®ææ¡ç çæå°å
è£
æ°ï¼"); |
| | | // return; |
| | | //} |
| | | |
| | | isStartListen = 1; |
| | | |
| | |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | } |
| | | Report.Print(false); |
| | | |
| | | //ç»ææååï¼æ¸
ç©ºç»ææ°é䏿ºåä¿¡æ¯ |
| | | set_clearPackQtyAndSourceInfo(); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | |
| | | return true; |
| | | }catch(Exception ex) |
| | | { |
| | | string sql = "exec h_p_WMS_PackBarCodeBill_dealDataWhenError '" + textBox_HPackBarCode + "'"; |
| | | oCn.RunProc(sql); |
| | | throw new Exception(ex.Message); |
| | | } |
| | | |
| | |
| | | { |
| | | if (e.KeyChar == (char)Keys.Return) |
| | | { |
| | | //é²é夿 |
| | | if(!judgeIsSameSourceBill(textBox_HBarCode.Text.Trim())) |
| | | { |
| | | textBox_HBarCode.Text = ""; |
| | | return; |
| | | } |
| | | |
| | | SetBarCode_Webs(); |
| | | textBox_HBarCode.Text = ""; |
| | | textBox_HBarCode.Focus(); |
| | | |
| | | autoProducePackBarCode(); |
| | | |
| | | if (grdMain.Rows.Count ==1 ) |
| | | { |
| | | getPackQty(grdMain.Rows[0].Cells[4].Value.ToString()); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception e2) |
| | |
| | | private void toolStripButton_Delete_Click(object sender, EventArgs e) |
| | | { |
| | | deleteGrdMainNote(); |
| | | |
| | | if (grdMain.Rows.Count== 0) |
| | | { |
| | | set_clearPackQtyAndSourceInfo(); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | if (grdMain.SelectedRows != null && grdMain.SelectedRows.Count==1) |
| | | { |
| | | if (MessageBox.Show("ç¡®å®è¦å é¤ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) |
| | | //if (MessageBox.Show("ç¡®å®è¦å é¤ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) |
| | | //{ |
| | | // return; |
| | | //} |
| | | //if (MessageBox.Show("å é¤åå°ä¸å¯æ¢å¤ï¼ç¡®å®è¦ç»§ç»æä½ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) |
| | | //{ |
| | | // return; |
| | | //} |
| | | |
| | | string pwd = Interaction.InputBox("请è¾å
¥å¯ç ", "å é¤ç¡®è®¤ï¼", "", 100, 100); |
| | | |
| | | //ç¹å»åæ¶ |
| | | if(pwd == "") |
| | | { |
| | | return; |
| | | } |
| | | if (MessageBox.Show("å é¤åå°ä¸å¯æ¢å¤ï¼ç¡®å®è¦ç»§ç»æä½ï¼", "æç¤º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Cancel) |
| | | |
| | | if(pwd != "123456") |
| | | { |
| | | MessageBox.Show("å¯ç é误ï¼"); |
| | | return; |
| | | } |
| | | |
| | | Delete(); |
| | | } |
| | | else |
| | |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | } |
| | | Report.Print(false); |
| | | |
| | | //ç»ææååï¼æ¸
ç©ºç»ææ°é䏿ºåä¿¡æ¯ |
| | | set_clearPackQtyAndSourceInfo(); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | |
| | | //è·åç¼ååè¡¨ä¸ ææ¡ç 对åºç ç»æè®°å½ |
| | | sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a inner join Gy_BarCodeBill as b on a.HBarCode = b.HBarCode where a.HBarCode_Pack = '" + HPackBarCode + "' and b.HSourceID = " + HSourceID + " and a.HStockorgID = " + HOrgID; |
| | | //sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a where a.HBarCode_Pack = '" + HPackBarCode + "' and a.HStockorgID = " + HOrgID; |
| | | ds = oCn.RunProcReturn(sql, "Sc_PackUnionBill_Temp"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | |
| | | textBox_sBillNo.Text = HBillNo; |
| | | |
| | | getDisplay_GrdMain(); |
| | | |
| | | if (grdMain.Rows.Count > 0 && grdMain.Rows[0].Cells[4].Value != null) |
| | | { |
| | | getPackQty(grdMain.Rows[0].Cells[4].Value.ToString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region æ ¹æ®æ¡ç ç¼å·ï¼è·åæ¡ç ä¸ç©ææå¯¹åºçç»ææ°éï¼åæ¶è®°å½æºå主IDãåID |
| | | private void getPackQty(string HBarCode) |
| | | { |
| | | string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where æ¡ç ç¼å· = '" + HBarCode + "'"; |
| | | DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty"); |
| | | if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0) |
| | | { |
| | | HSourceInterID_ICMO = 0; |
| | | HSourceEntryID_ICMO = 0; |
| | | |
| | | textBox_PackQty.Text = ""; |
| | | return; |
| | | } |
| | | |
| | | HSourceInterID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString()); |
| | | HSourceEntryID_ICMO = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString()); |
| | | textBox_PackQty.Text = Double.Parse(ds_getPackQty.Tables[0].Rows[0]["ç»ææ°é"].ToString()).ToString(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 夿å½åæ«æçæ¡ç æ¯å¦ä¸å·²ç»æ«æè¿çæ¡ç 为åä¸å·¥åçæç |
| | | private bool judgeIsSameSourceBill(string HBarCode) |
| | | { |
| | | if (grdMain.Rows.Count == 0) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | string sql = "select * from h_v_IF_BarCodeBillList_getPackQty where æ¡ç ç¼å· = '" + HBarCode + "'"; |
| | | DataSet ds_getPackQty = oCn.RunProcReturn(sql, "h_v_IF_BarCodeBillList_getPackQty"); |
| | | if (ds_getPackQty == null || ds_getPackQty.Tables[0].Rows.Count <= 0) |
| | | { |
| | | MessageBox.Show("å½åæ¡ç ä¸åå¨ï¼"); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | int HSourceInterID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceInterID"].ToString()); |
| | | int HSourceEntryID_ICMO_Bak = int.Parse(ds_getPackQty.Tables[0].Rows[0]["HSourceEntryID"].ToString()); |
| | | if (HSourceInterID_ICMO != HSourceInterID_ICMO_Bak || HSourceEntryID_ICMO != HSourceEntryID_ICMO_Bak) |
| | | { |
| | | MessageBox.Show("å½åæ«æçæ¡ç ä¸ä¹åææ«æçæ¡ç å·¥åä¸ä¸è´ï¼"); |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region æ¸
空 ç»ææ°é ä¸è®°å½çæºå主IDãåID |
| | | private void set_clearPackQtyAndSourceInfo() |
| | | { |
| | | textBox_PackQty.Text = ""; |
| | | HSourceInterID_ICMO = 0; |
| | | HSourceEntryID_ICMO = 0; |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | |