protected void txt_Shelf_TextChanged(object sender, EventArgs e) { try { lbl_Message.Text = ""; var sp = new ShelfProcess(); var input = txt_Shelf.Text.Trim(); int?shelfType = sp.CheckStorage(input, _areaId); if (shelfType != (int)Utility.StorageType.補貨儲位 && shelfType != (int)Utility.StorageType.展售儲位) { lbl_Message.Text = "此儲位只能為補貨/展售儲位!"; gv_product_id.Visible = false; btnPrintShelf.Visible = false; } else { var shipDa = new POS_Library.ShopPos.ShipInDA(); int xx = 1; var BLList = shipDa.GetShelfDetails(input).Select(x => new { 序號 = xx++, 產品編號 = x.ProductId, 產品條碼 = x.Barcode, 數量 = x.Quantity, 價格 = x.Price }).ToList(); if (BLList.Any()) { gv_product_id.DataSource = BLList; gv_product_id.DataBind(); for (var i = 0; i < BLList.Count; i++) { GridViewRow row = gv_product_id.Rows[i]; row.Cells[0].Text = BLList[i].序號.ToString(); row.Cells[1].Text = BLList[i].產品編號; row.Cells[2].Text = BLList[i].產品條碼; DropDownList ddl = row.Cells[3].FindControl("DDL_Quantity") as DropDownList; ddl.SelectedValue = BLList[i].數量; row.Cells[4].Text = BLList[i].價格; } gv_product_id.Visible = true; btnPrintShelf.Visible = true; } } } catch (Exception ex) { lbl_Message.Text = "請輸入正確的資訊!"; gv_product_id.Visible = false; btnPrintShelf.Visible = false; } }
/// <summary> /// 驗傳票 /// </summary> /// <param name="ticketId"></param> /// <param name="account"></param> /// <param name="areaId"></param> /// <param name="flowType"></param> public void GetListTicket(int ticketId, string account, int areaId, int flowType) { lblTicketId.Text = ticketId.ToString(); var list = new List <POS_Library.ShopPos.DataModel.ImportClass.TicketDetailModel>(); var shipDa = new POS_Library.ShopPos.ShipInDA(); try { list = shipDa.GetTicketDetail(ticketId, account, areaId); if (!list.Any()) { lbl_Message.Text = "此傳票已無可驗的資料!!請離開!!"; return; } else { for (int i = 0; i < list.Count; i++) { ListItem LItem = new ListItem(); LItem.Value = list[i].Barcode + "," + list[i].TicketId + "," + flowType + "," + list[i].Quantity + "," + list[i].Id; LItem.Text = list[i].ProductId + "__X " + list[i].Quantity.ToString(); LItem.Attributes.Add("TicketId", list[i].TicketId); LItem.Attributes.Add("ProductId", list[i].ProductId); LItem.Attributes.Add("Quantity", list[i].Quantity.ToString()); LB_Product_Id1.Items.Add(LItem); } List <string> errorList = new List <string>(); if (errorList.Count > 0) { LB_Product_Id1.Items.Clear(); txt_VerifyCheck_NO.Enabled = false; foreach (var item in errorList) { Response.Write(item); } } CheckNumToLabel(); } } catch (Exception ex) { lbl_Message.Text = ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { try { //判斷帳號登入 if (Session["Account"] == null) { Response.Write(" <script> parent.document.location= 'logout.aspx' </script> "); Response.End(); } else { lbl_Message.Text = string.Empty; if (!IsPostBack) { var account = Session["Account"].ToString(); var box = Request["box"].Trim(); var areaId = int.Parse(Request["areaId"].Trim()); var importType = int.Parse(Request["importType"].Trim()); var ticketType = int.Parse(Request["ticketType"].Trim()); var flowType = importType == 0 ? (int)EnumData.FlowType.門市進貨 : importType; ViewState["areaId"] = areaId; ViewState["flowType"] = flowType; ViewState["ticketType"] = ticketType; ViewState["importType"] = importType; lblbox.Text = box; var shipDa = new POS_Library.ShopPos.ShipInDA(); var tickets = shipDa.PosBoxDetail(box, areaId).Where(x => x.Verify == false).Select(x => x.TicketId).Distinct().ToArray(); lblTicketId.Text = string.Join(",", tickets); GetListBox(box, account, areaId, flowType); } txt_VerifyCheck_NO.Focus(); } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// 加入缺件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Lack_Click(object sender, EventArgs e) { try { #region 撿查 //缺少數量條件為 : 輸入缺少數量不可大於原傳票產品數量 var listBoxs = ListBoxProducts(); //輸入產品、輸入數量 var inputProductId = txt_More_ProdoctID.Text; var inputQ = txt_More_ProdoctNum.Text; //原產品、原數量 var oldProductId = lbl_P.Text; var oldQ = lbl_Q.Text; var ticketId = txt_ticket_id.Text.Trim(); //目前缺少總數量 var nowlackQ = 0; if (string.IsNullOrEmpty(inputQ)) { lbl_Message.Text = " 請輸入數量!"; return; } if (listBoxs.FirstOrDefault(x => x.IsLack == false && x.Product == inputProductId) != null) { lbl_Message.Text = " 輸入缺少數量不可同時有多出的產品!"; return; } var listBox = listBoxs.FirstOrDefault(x => x.Product == inputProductId && x.IsLack); if (listBox != null) { nowlackQ = int.Parse(inputQ) + listBox.Quantity; } else { nowlackQ = int.Parse(inputQ); } if (inputProductId == oldProductId && nowlackQ > int.Parse(oldQ)) { lbl_Message.Text = " 輸入缺少數量不可大於原傳票產品數量!"; return; } //檢查原因 if (DDL_Reason.SelectedValue == "未選擇") { lbl_Message.Text = "海運差異→請選擇原因"; return; } var flowType = NameToType(lbl_FlowStatus.Text); //檢查差異回報是否大於傳票數 var shipDa = new POS_Library.ShopPos.ShipInDA(); var ckTicketQ = shipDa.CkTicketAndDiff(int.Parse(ticketId), inputProductId, nowlackQ, _areaId); if (ckTicketQ.Result == "0") { lbl_Message.Text = ckTicketQ.Reason; return; } if (oldProductId != inputProductId) { lbl_Message.Text = " 不可輸入原產品以外的產品!"; return; } if (flowType == 0) { lbl_Message.Text = "字形無法解析!請重新回報! " + lbl_FlowStatus.Text; return; } #endregion 撿查 DiffBox(true, flowType); } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// 傳票數量異常回報(第一次驗貨回報) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn_Send_Click(object sender, EventArgs e) { try { if (DDL_Reason.SelectedValue == "未選擇") { lbl_Message.Text = "請選擇原因"; return; } var listBoxs = ListBoxProducts(); var ticketId = int.Parse(txt_ticket_id.Text.Trim()); if (listBoxs.Any()) { var flowType = NameToType(lbl_FlowStatus.Text); if (flowType == 0) { lbl_Message.Text = "字形無法解析!請重新回報!"; return; } var issueReportList = new List <POS_Library.DB.IssueReport>(); var shipDa = new POS_Library.ShopPos.ShipInDA(); int store = POS_Library.Public.Utility.GetStore(_areaId); var box = shipDa.GetPosTicketBox(int.Parse(txt_ticket_id.Text.Trim()), _areaId); var comment = "POS:" + DDL_Reason.SelectedValue; //把ListBox中的串成List foreach (var item in listBoxs) { //經由傳票回報所以一定要有傳票資訊 POS_Library.DB.IssueReport iss = new POS_Library.DB.IssueReport(); //填入傳票,建立者,建立日期,產品編號,數量,缺或多件,倉庫類別 iss.TicketId = ticketId; iss.BoxNum = box; iss.CreateAuditor = account; iss.CreateDate = DateTime.Now; iss.ProductId = item.Product; iss.Quantity = item.Quantity; iss.IsQuantity = item.IsLack != true; iss.ShopType = store; iss.FlowStatus = flowType; iss.Comment = comment; issueReportList.Add(iss); } //寫入issueReport result = shipDa.SetDiff(issueReportList); if (result != null) { lbl_Message.Text = result.Reason; //成功清空 if (result.Result == "1") { LB_Product_Id1.Items.Clear(); } } } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
/// <summary> /// 差異 /// </summary> /// <param name="isLack"></param> /// <param name="flowType"></param> protected void DiffBox(bool isLack, int flowType) { try { var productId = txt_More_ProdoctID.Text.Trim(); num = txt_More_ProdoctNum.Text.Trim(); if (productId != "" && num != "") { //條碼轉產編(2013-0319新增)--------------------------------- if (CF.CheckID(productId, CheckFormat.FormatName.Product)) { productId = sp.GetProductNum(productId); } //---------------------------------------------------------- //productId = WMS_Library.ProductStorage.NoProduct.GetProduct(productId); //if (String.IsNullOrEmpty(productId)) //{ // lbl_Message.Text = "請輸入正確產品!"; // return; //} if (int.Parse(num) > 0) { if (!string.IsNullOrEmpty(txt_ticket_id.Text)) { var shipDa = new POS_Library.ShopPos.ShipInDA(); int store = POS_Library.Public.Utility.GetStore(_areaId); var isTrue = shipDa.IsIssueReport(int.Parse(txt_ticket_id.Text.Trim()), productId, store, flowType); if (isTrue.Result == "1") { lbl_Message.Text = "此產品已回報過!"; return; } } ListItem LItem = new ListItem(); string quantity = string.Empty; if (isLack) { quantity = "-" + txt_More_ProdoctNum.Text.Trim(); } else { quantity = txt_More_ProdoctNum.Text.Trim(); } LItem.Value = productId + "," + txt_More_ProdoctNum.Text.Trim() + "," + isLack; LItem.Text = productId + " x " + quantity; LB_Product_Id1.Items.Add(LItem); txt_More_ProdoctNum.Text = ""; txt_More_ProdoctID.Text = ""; } else { lbl_Message.Text = "請輸入正確數量!"; } } else { lbl_Message.Text = "請輸入產品名稱及數量!"; } } catch (Exception ex) { Response.Write("系統發生錯誤 " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Account"] == null) { Response.Write(" <script> parent.document.location= 'logout.aspx' </script> "); Response.End(); } else { account = Session["Account"].ToString(); if (!IsPostBack) { if (Request["storage"] == null || Request["ticketType"] == null || Request["flowType"] == null || Request["pagekey"] == null || Request["areaId"] == null || Request["importType"] == null) { lbl_Message.Text = "資料錯誤!!"; return; } var shelf = Request["storage"]; var importType = Request["importType"]; var ticketType = Request["ticketType"]; var flowType = int.Parse(Request["flowType"].ToString()); var pagekey = Request["pagekey"]; var areaId = Request["areaId"]; ViewState["flowType"] = flowType; ViewState["pagekey"] = pagekey; ViewState["areaId"] = areaId; ViewState["importType"] = importType; ViewState["ticketType"] = ticketType; lbl_Storage_NO.Text = shelf; if (Session["ProductDatas"] != null) { tempallproduct = Session["ProductDatas"] as List <ImportClass.ProductData>; Session["ProductDatas"] = null; } else { lbl_Message.Text = "時間過長!!請重新動做!!"; return; } //改成function(2014-0425修改) var flowT = FlowType(flowType); if (flowT == 0) { lbl_Message.Text = "無此類型入庫!!"; return; } var shipDa = new POS_Library.ShopPos.ShipInDA(); var ticks = tempallproduct.Select(x => int.Parse(x.Ticket)).Distinct().ToList(); int store = POS_Library.Public.Utility.GetStore(int.Parse(areaId)); var issue = shipDa.GetIssueReports(ticks, store, flowType).Where(x => string.IsNullOrEmpty(x.HandleAuditot)).ToList(); //依驗貨完的傳票尋找是否有回報問題的傳票產品 var diffs = issue.Select(x => new ImportClass.ProductData() { Ticket = x.TicketId.Value.ToString(), Name = x.ProductId, Quantity = x.Quantity, IsQuantity = x.IsQuantity }).ToList(); if (tempallproduct.Count > 0) { lbl_ProductNormal.Text = "內容:<br />"; CompositeListBox(tempallproduct, false); } else { btn_Check.Visible = false; listboxNormal.Visible = false; } if (issue.Any()) { lbl_ProductDiff.Text = "差異:<br />"; CompositeListBox(diffs, true); } else { listboxDiff.Visible = false; } //顯示儲位類型 lbl_Storage_NO_Type.Text = CF.TypeToName(shipDa.CheckStorage(lbl_Storage_NO.Text, int.Parse(areaId))); } } }
/// <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); } }