/// <summary> /// 確定上架 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Submit_Click(object sender, EventArgs e) { try { ////判斷件數是否相符 換色 //if (lbl_CurrentNum.Text == txt_Num.Text) //{ lbl_CurrentNum.ForeColor = System.Drawing.Color.Blue; String[] product = lbl_Product.Text.Split('<'); var productList = new List <ImportClass.ProductData>(); for (int i = 0; i < product.Length; i++) { var data = new ImportClass.ProductData(); data.Name = product[i].Replace("br />", ""); data.Quantity = 1; productList.Add(data); } //執行合併 result = sp.SetShelfProduct(lbl_TargetStorage_NO.Text, productList, account, true, _areaId, (int)POS_Library.ShopPos.EnumData.StorageDetailType.入庫無條件上架); if (result.Result == "1") { lbl_Message.Text = "共 " + product.ToList().Count + " 件 上架成功!"; //清空 lbl_Product.Text = ""; lbl_TargetStorage_NO.Text = ""; lbl_TargetStorage_NO_Type.Text = ""; lbl_CurrentNum.Text = "0"; txt_Num.Text = ""; } else { lbl_Message.Text = result.Reason; } //} //else //{ // lbl_CurrentNum.ForeColor = System.Drawing.Color.OrangeRed; // lbl_Message.Text = "件數不符!"; //} } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
protected List <ImportClass.ProductData> GetProducts(string[] products, string[] ticketIds) { var ps = new List <ImportClass.ProductData>(); for (int i = 0; i < products.Count(); i++) { var p = new ImportClass.ProductData(); var reg = Regex.Match(products[i], @"(\w.*)(_)(.*)"); p.Ticket = ticketIds[i]; p.Name = reg.Groups[1].Value.Trim(); p.Quantity = int.Parse(reg.Groups[3].Value); p.IsQuantity = true; ps.Add(p); } return(ps); }
/// <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); } }
/// <summary> /// 回報 /// </summary> /// <returns></returns> protected MsgStatus Report() { try { var shipDa = new POS_Library.ShopPos.ShipInDA(); var flowType = int.Parse(ViewState["flowType"].ToString()); var box = ViewState["pagekey"].ToString(); var importType = int.Parse(ViewState["importType"].ToString()); var ticketType = int.Parse(ViewState["ticketType"].ToString()); var areaId = int.Parse(ViewState["areaId"].ToString()); var result = new MsgStatus(); //正確驗貨產品 var products = new List <ImportClass.ProductData>(); for (int i = 0; i < listboxNormal.Items.Count; i++) { var product = new ImportClass.ProductData(); string[] array = listboxNormal.Items[i].Value.Split(','); product.Ticket = array[0]; product.Name = array[1].Trim().ToUpper(); product.Quantity = int.Parse(array[2]); product.IsQuantity = true; product.Id = array[4]; products.Add(product); } //差異產品 var diffs = new List <ImportClass.ProductData>(); for (int i = 0; i < listboxDiff.Items.Count; i++) { var diff = new ImportClass.ProductData(); string[] array = listboxDiff.Items[i].Value.Split(','); diff.Shelf = box; diff.Ticket = array[0]; diff.Name = array[1].Trim().ToUpper(); diff.Quantity = int.Parse(array[2]); diff.IsQuantity = bool.Parse(array[3]); diff.Id = array[4]; diffs.Add(diff); } #region ※比對差異回報有無異常防呆(2014-0425新增) var ticks = products.Select(x => int.Parse(x.Ticket)).Distinct().ToList(); int store = POS_Library.Public.Utility.GetStoreForShop(areaId); var p = products.Select(x => x.Name).ToArray(); var issue = shipDa.GetIssueReports(ticks, store, flowType).Where(x => string.IsNullOrEmpty(x.HandleAuditot) && p.Contains(x.ProductId)).ToList(); var diffs2 = issue.Where(x => !x.IsQuantity).Select(x => new ImportClass.ProductData() { Ticket = x.TicketId.Value.ToString(), Name = x.ProductId, Quantity = x.Quantity, IsQuantity = x.IsQuantity }).ToList(); var diffC = diffs2.Count; for (int i = 0; i < diffC; i++) { if ((products.Count(x => x.Name == diffs2[i].Name) == 0)) { diffs2.Remove(diffs2[i]); } } //foreach (var item in diffs2) //{ // //產品沒驗到就不顯示少的(2013-0411新增) // if ((products.Count(x => x.Name == item.Name) == 0) && !item.IsQuantity) // { // diffs2.Remove(item); // if (!diffs2.Any()) // break; // } //} if (diffs.Count(x => !x.IsQuantity) != diffs2.Count) { return(POS_Library.Public.Utility.GetMessage("0", "差異回報筆數異常!請重新驗貨進入此頁面!")); } #endregion ※比對差異回報有無異常防呆(2014-0425新增) //依驗貨完的傳票尋找是否有回報問題的傳票產品 var ckNormals = shipDa.CkNormals(products, diffs); if (ckNormals.Result == "0") { return(ckNormals); } if (products.Count > 0) { result = shipDa.SetTempShelfProduct(lbl_Storage_NO.Text, products, account, true, flowType, areaId); if (result.Result == "0") { return(result); } } if (diffs.Count > 0) { result = shipDa.SetTempDiffEdit(lbl_Storage_NO.Text, diffs, importType, ticketType, flowType, account, store, areaId); } return(result); } catch (Exception ex) { throw new Exception(ex.Message); } }