public CheckObject(string startStr, int startErrMsg, int fillerErrMsg, int nextState, HashSet <string> nextStartStrs, CheckFormat fillerFormat, string delim) : this(startStr, startErrMsg, fillerErrMsg, nextState, nextStartStrs, fillerFormat) { delim_ = delim; }
protected void Btn_Execution_Click(object sender, EventArgs e) { try { Button btn = sender as Button; CheckFormat CF = new CheckFormat(); foreach (GridViewRow row in gv_List.Rows) { Button btnTest = row.Cells[0].FindControl("Btn_Execution") as Button; //判斷是否是按下按鈕的那一行 if (btnTest == btn) { var txtTemp = row.Cells[4].FindControl("LackNum") as TextBox; if (CF.CheckID(txtTemp.Text, CheckFormat.FormatName.Number)) { string lackQuantity = txtTemp.Text.Trim(); string originalQuantity = row.Cells[3].Text.Trim(); //缺少數量 <= 應有數量 if (int.Parse(lackQuantity) == 0) { lbl_Message.Text = "數量不可為0!"; } else if (int.Parse(lackQuantity) <= int.Parse(originalQuantity)) { var productStatus = RB_Flaw.SelectedValue; //儲位名稱,商品編號,應有數量,短缺數量 string noProductData = string.Format("{0},{1},{2},{3}", row.Cells[1].Text.Trim(), row.Cells[2].Text.Trim(), row.Cells[3].Text.Trim(), lackQuantity); string account = row.Cells[9].Text.Trim(); string reason = DDL_Reason.SelectedValue; var url = "NoProductCheck.aspx?pickNum=" + lblPickNo.Text + "&productStatus=" + productStatus + "&noProductData=" + noProductData + "&account=" + account + "&reason=" + reason + "&PageKey=" + PageKey; Page.RegisterClientScriptBlock("checkinput", @"<script>window.open('" + url + "','_self');</script>"); } else { lbl_Message.Text = "缺少數量 超過 應有數量!"; } } else { lbl_Message.Text = "請輸入正確數字!"; } } } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
public CheckObject(string startStr, int startErrMsg, int fillerErrMsg, int nextState, HashSet <string> nextStartStrs, CheckFormat fillerFormat) { startStr_ = startStr; delim_ = "="; startErrMsg_ = startErrMsg; fillerErrMsg_ = fillerErrMsg; nextState_ = nextState; nextStartStrs_ = nextStartStrs; nextLine_ = null; fillerFormat_ = fillerFormat; if (!ReferenceEquals(startStr, null)) { isTab_ = startStr.StartsWith("\t", StringComparison.Ordinal); } }
/// <summary> /// 原js改寫 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void txt_VerifyCheck_NO_TextChanged(object sender, EventArgs e) { try { lbl_Message.Text = ""; CheckFormat CF = new CheckFormat(); LB_Product_Id1.ClearSelection(); LB_Product_Id2.ClearSelection(); //全過 if (txt_VerifyCheck_NO.Text == "2") { int total = LB_Product_Id1.Items.Count; for (int i = 0; i < total; i++) { LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[0]); LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[0]); } } //還原一筆 else if (txt_VerifyCheck_NO.Text == "0") { if (LB_Product_Id2.Items.Count > 0) { LB_Product_Id1.Items.Insert(0, LB_Product_Id2.Items[0]); LB_Product_Id2.Items.Remove(LB_Product_Id2.Items[0]); } } else if (Regex.IsMatch(txt_VerifyCheck_NO.Text, "^\\d{8}$")) { bool find = false; for (int i = 0; i < LB_Product_Id1.Items.Count; i++) { if (LB_Product_Id1.Items[i].Value.Split(',')[0] == txt_VerifyCheck_NO.Text) { LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[i]); LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[i]); find = true; break; } } //如果不在清單中 顯示(多出) if (!find) { lbl_Message.Text = "這個商品不是這張傳票的!"; } } //如果輸入的是儲位barcode 跳至差異清單 else if (CF.CheckID(txt_VerifyCheck_NO.Text.Trim(), CheckFormat.FormatName.Storage)) { string storage = txt_VerifyCheck_NO.Text.Trim(); var listLeft = new List <string>(); var listRight = new List <string>(); int areaId = int.Parse(ViewState["areaId"].ToString()); var flowType = ViewState["flowType"].ToString(); var importType = ViewState["importType"].ToString(); var ticketType = ViewState["ticketType"].ToString(); ShelfProcess sp = new ShelfProcess(); var shelf = sp.GetSearchStorage(storage, areaId); var storageType = EnumData.StorageType.標準暫存儲位; //if (_flowType == (int)EnumData.FlowType.門市調回) //{ // storageType = EnumData.StorageType.調回暫存儲位; //} //else if (_flowType == (int)EnumData.FlowType.換貨) //{ // storageType = EnumData.StorageType.換貨暫存儲位; //} //else if (_flowType == (int)EnumData.FlowType.台組進貨) //{ // storageType = EnumData.StorageType.海運暫存儲位; //} if (shelf.Type != (int)storageType) { lbl_Message.Text = "這個儲位不屬於" + storageType.ToString() + "!"; return; } //串多少& 缺少的字串 for (int i = 0; i < LB_Product_Id1.Items.Count; i++) { listLeft.Add(LB_Product_Id1.Items[i].Text.Split('_')[0]); } var productDatas = new List <ImportClass.ProductData>(); for (int i = 0; i < LB_Product_Id2.Items.Count; i++) { var productData = new ImportClass.ProductData(); productData.Id = LB_Product_Id2.Items[i].Value.Split(',')[4]; productData.Name = LB_Product_Id2.Items[i].Text.Split('_')[0]; productData.Quantity = int.Parse(LB_Product_Id2.Items[i].Value.Split(',')[3]); productData.Ticket = LB_Product_Id2.Items[i].Value.Split(',')[1]; productDatas.Add(productData); listRight.Add(LB_Product_Id2.Items[i].Text.Split('_')[0]); } if (listLeft.Any()) { lbl_Message.Text = "以下產品尚未驗完:" + string.Join(",", listLeft.Count); txt_VerifyCheck_NO.Text = ""; return; } if (!listRight.Any()) { lbl_Message.Text = "還沒驗到貨!請再次確認!"; return; } Session["ProductDatas"] = productDatas; Session["storage"] = storage; Session["flowType"] = flowType; Session["pagekey"] = lblbox.Text; //------------------------------------------------------ //箱號驗貨 var url = "DiffList.aspx?storage=" + storage + "&ticketType=" + ticketType + "&flowType=" + flowType + "&pagekey=" + lblbox.Text + "&areaId=" + areaId + "&importType=" + importType; //Response.Redirect(url); Page.RegisterClientScriptBlock("checkinput", @"<script>window.open('" + url + "','_self');</script>"); txt_VerifyCheck_NO.Enabled = false; } else { lbl_Message.Text = "這個商品不是這張傳票的!"; } txt_VerifyCheck_NO.Text = ""; //更新數量 CheckNumToLabel(); txt_VerifyCheck_NO.Focus(); } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
protected void txt_productId_TextChanged(object sender, EventArgs e) { try { var sp = new ShelfProcess(); var str_input = txt_productId.Text.Trim().ToUpper(); var quantity = int.Parse(DDL_Quantity.SelectedValue); var productId = string.Empty; var productBarcode = string.Empty; CheckFormat CF = new CheckFormat(); //檢查輸入是否為條碼 if (CF.CheckID(str_input, CheckFormat.FormatName.Product)) { //檢查是否為有效條碼 string chProduct = sp.GetProductNum(txt_productId.Text); if (string.IsNullOrEmpty(chProduct)) { lbl_Message.Text = "掃入條碼有誤!"; return; } else { productId = chProduct; string chBarcode = sp.GetProductPriceBarcode(chProduct); productBarcode = chBarcode; } } else { //檢查是否為有效產品 string chBarcode = sp.GetProductPriceBarcode(str_input); if (string.IsNullOrEmpty(chBarcode)) { lbl_Message.Text = "掃入條碼有誤!"; return; } else { productId = str_input; productBarcode = chBarcode; } } for (int i = 0; i < quantity; i++) { ListItem product = new ListItem(); product.Text = productId; product.Value = productBarcode; lsbList.Items.Add(product); } txt_productId.Text = ""; lbl_Message.Text = ""; btnPrintProduct.Visible = true; txt_productId.Focus(); } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
public CheckObject(string startStr, int startErrMsg, int fillerErrMsg, int nextState, HashSet <string> nextStartStrs, HashSet <string> nextLine, CheckFormat fillerFormat) : this(startStr, startErrMsg, fillerErrMsg, nextState, nextStartStrs, fillerFormat) { nextLine_ = nextLine; }
/// <summary> /// 輸入txtbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void txt_VerifyCheck_NO_TextChanged(object sender, EventArgs e) { lbl_Message.Text = ""; var store = int.Parse(ViewState["store"].ToString()); var areaId = int.Parse(ViewState["areaId"].ToString()); ShelfProcess sp = new ShelfProcess(); CheckFormat CF = new CheckFormat(); LB_Product_Id1.ClearSelection(); LB_Product_Id2.ClearSelection(); var 傳票ID = lbl_ticket_id.Text.Trim(); //全過 if (txt_VerifyCheck_NO.Text == "2") { int total = LB_Product_Id1.Items.Count; for (int i = 0; i < total; i++) { LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[0]); LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[0]); } } //還原一筆 else if (txt_VerifyCheck_NO.Text == "0") { if (LB_Product_Id2.Items.Count > 0) { LB_Product_Id1.Items.Insert(0, LB_Product_Id2.Items[0]); LB_Product_Id2.Items.Remove(LB_Product_Id2.Items[0]); } } //確認 else if (txt_VerifyCheck_NO.Text == "1") { if (LB_Product_Id1.Items.Count != 0) { lbl_Message.Text = "部分商品未驗!"; return; } else if (string.IsNullOrEmpty(傳票ID)) { lbl_Message.Text = "傳票不可為空!"; return; } else { var shipDa = new POS_Library.ShopPos.ShipOutDA(); var msg = shipDa.LeaveWithVerify(int.Parse(傳票ID), account, store, DateTime.Now, areaId); if (msg.Result == "1") { lbl_Message.Text = "驗貨完成!"; txt_VerifyCheck_NO.Enabled = false; } else { lbl_Message.Text = msg.Reason; } } } //產品編號 else if (Regex.IsMatch(txt_VerifyCheck_NO.Text, "^\\d{8}$")) { bool find = false; for (int i = 0; i < LB_Product_Id1.Items.Count; i++) { //if (LB_Product_Id1.Items[i].Value == txt_VerifyCheck_NO.Text) //{ //lbl_Message.Text = LB_Product_Id1.Items[i].Value.Split(',')[4]; if (LB_Product_Id1.Items[i].Value.Split(',')[0] == txt_VerifyCheck_NO.Text) { LB_Product_Id2.Items.Insert(0, LB_Product_Id1.Items[i]); LB_Product_Id1.Items.Remove(LB_Product_Id1.Items[i]); find = true; break; } } if (!find) { lbl_Message.Text = "這個商品不是這張傳票的!"; //LB_Product_Id2.Items.Insert(0, new ListItem(sp.GetProductNum(txt_VerifyCheck_NO.Text) + "(多出)", txt_VerifyCheck_NO.Text)); } } else if (CF.CheckID(txt_VerifyCheck_NO.Text, CheckFormat.FormatName.Storage)) { if (LB_Product_Id1.Items.Count == 0) { int?type = sp.CheckStorage(txt_VerifyCheck_NO.Text, areaId); if (type == 6 || type == 7) { string product = ""; for (int i = 0; i < LB_Product_Id2.Items.Count; i++) { product = string.IsNullOrEmpty(product) ? product : product + ","; product += LB_Product_Id2.Items[i].Text; } //Response.Redirect("~/DiffList.aspx?product=" + product + "&ticketId=" + lbl_ticket_id.Text + "&storage=" + txt_VerifyCheck_NO.Text.Trim()); } else { lbl_Message.Text = "僅可為暫存儲位或不良暫存儲位!"; } } else { lbl_Message.Text = "尚有產品未驗!"; } } else { lbl_Message.Text = "這個商品不是這張傳票的!"; } txt_VerifyCheck_NO.Text = ""; txt_VerifyCheck_NO.Focus(); }
public static bool CheckSlotFiller(LineObject lineObject, bool printFlag, CheckObject checkObject, TokenObject tokenObject, bool checkLength) { string line = lineObject.GetLine(); bool isTab = checkObject.IsTab(); string slot = null; string filler = null; string delim = checkObject.GetDelim(); int index = line.IndexOf(delim, StringComparison.Ordinal); if (index != -1) { if (ReferenceEquals(delim, "=")) { slot = line.Substring(0, index + 1); filler = line.Substring(index + 1); } else { slot = line.Substring(0, index + 1); filler = line; } } else { ErrMsg.PrintErrMsg(printFlag, 80, lineObject, line, 0, line.Length, isTab); return(false); } bool flag = false; string startStr = checkObject.GetStartStr(); if (!ReferenceEquals(startStr, null)) { flag = slot.Equals(startStr); } if (!flag) { ErrMsg.PrintErrMsg(printFlag, checkObject.GetStartErrMsg(), lineObject, slot, 0, index, isTab); return(flag); } flag = CheckFillerFormat.IsLegalFormat(printFlag, lineObject, filler, index, isTab, checkLength); if (!flag) { return(false); } CheckFormat fillerFormat = checkObject.GetFillerFormat(); if (fillerFormat != null) { flag = fillerFormat.IsLegalFormat(filler); if (!flag) { ErrMsg.PrintErrMsg(printFlag, checkObject.GetFillerErrMsg(), lineObject, filler, index + 1, index + filler.Length, isTab); return(flag); } } if ((flag == true) && (tokenObject != null)) { tokenObject.SetToken(filler); } return(flag); }