//確認條碼資料 protected void btnCheck_Click(object sender, EventArgs e) { ErrorMsgLabel.Text = ""; string PurchaseNo = string.Empty; string Vendor = string.Empty; string Item = string.Empty; string Period = string.Empty; string Cost = string.Empty; string Price = string.Empty; string TaxType = string.Empty; string PURCHASE_QTY = string.Empty; string PLAN_ACCEPT_DATE = string.Empty; string accept_qty = string.Empty; string Qty = string.Empty; string DIS_Qty = string.Empty; this.SLP_SKU.Text = string.Empty; this.txtPeriod.Text = string.Empty; this.txtPurQty.Text = string.Empty; this.hid_Cost.Value = string.Empty; this.hid_TaxType.Value = string.Empty; this.SLP_InDate.Text = string.Empty; this.txtSellPrice.Text = string.Empty; this.txtTAccQty.Text = string.Empty; this.txtTQty.Text = string.Empty; this.txtDisQty.Text = string.Empty; this.txtTSQty.Text = string.Empty; this.txtLessQty.Text = string.Empty; bool ISOK = false; try { VGIModel.MaintainAccept dbo = new VGIModel.MaintainAccept(ConntionDB); ISOK = dbo.QueryPurchaseMaster(Request[txtItemCode.UniqueID], Request[txtPeriodCode.UniqueID], out PurchaseNo, out Vendor); if (this.txtPurNo.Text == string.Empty && this.SLP_Vendor.Text == string.Empty) { if (ISOK == false) { this.ErrorMsgLabel.Text = "驗收品項資料未開立採購單"; this.hid_Bill_Ini.Value = "0"; SetClinetFocus(txtBarCode.ClientID); return; } else { this.txtPurNo.Text = PurchaseNo; this.SLP_Vendor.Text = Vendor; } } else { if (ISOK == false) { this.ErrorMsgLabel.Text = "驗收品項資料未開立採購單"; this.hid_Bill_Ini.Value = "0"; SetClinetFocus(txtBarCode.ClientID); return; } else { if (IsSamePurchaseNo(PurchaseNo, txtItemCode.Text, txtPeriodCode.Text) == false) { this.ErrorMsgLabel.Text = "驗收品項的採購單號不同,請另開驗收單進行驗收"; return; } } } ISOK = dbo.QueryItemData(this.txtItemCode.Text, this.txtPeriodCode.Text, this.txtPurNo.Text, out Item, out Period, out Cost, out Price, out TaxType, out PURCHASE_QTY, out PLAN_ACCEPT_DATE, out accept_qty, out Qty, out DIS_Qty); if (ISOK == false) { ErrorMsgLabel.Text = "驗收品項資料未開立採購單"; this.hid_Bill_Ini.Value = "0"; SetClinetFocus(txtBarCode.ClientID); return; } string Flag = dbo.CheckItemApprove(Item, Period); if (Flag != "0") { if (Flag == "1") { ErrorMsgLabel.Text = "品號" + Item + "主檔資料未審核,請先審核再進行驗收作業"; } else { ErrorMsgLabel.Text = "品號" + Item + "已過期別結束日,不可進行驗收作業"; } hid_Bill_Ini.Value = "0"; SetClinetFocus(txtBarCode.ClientID); return; } hid_Bill_Ini.Value = "1"; this.SLP_SKU.Text = Item; this.txtPeriod.Text = Period; this.txtPurQty.Text = PURCHASE_QTY; this.hid_Cost.Value = Cost; this.hid_TaxType.Value = TaxType; this.SLP_InDate.Text = PLAN_ACCEPT_DATE; this.txtSellPrice.Text = Price; this.txtTAccQty.Text = accept_qty; this.txtTQty.Text = Qty; this.txtDisQty.Text = DIS_Qty; if (accept_qty == "") { txtTAccQty.Text = "0"; } if (Qty == "") { txtTQty.Text = "0"; } if (DIS_Qty == "") { txtDisQty.Text = "0"; } this.txtTSQty.Text = (int.Parse(txtPurQty.Text) - int.Parse(txtTAccQty.Text)).ToString(); this.txtLessQty.Text = (int.Parse(txtTQty.Text) - int.Parse(txtDisQty.Text)).ToString(); SLP_PackNum.Text = "1"; ParameterList.Clear(); ParameterList.Add(Item); ParameterList.Add(Period); ParameterList.Add(DateTime.Now.ToString("yyyy/MM/dd")); DataTable Dt_Item = dbo.GetItemDetail(ParameterList); if (Dt_Item.Rows.Count > 0) { SLP_SWeight.Text = Dt_Item.Rows[0]["s_weight"].ToString(); SLP_SLength.Text = Dt_Item.Rows[0]["s_length"].ToString(); SLP_SWidth.Text = Dt_Item.Rows[0]["s_width"].ToString(); SLP_SHeigh.Text = Dt_Item.Rows[0]["s_height"].ToString(); SLP_PackNum.Text = Dt_Item.Rows[0]["package_unit"].ToString(); SLP_PWeight.Text = Dt_Item.Rows[0]["p_weight"].ToString(); SLP_PLength.Text = Dt_Item.Rows[0]["p_length"].ToString(); SLP_PWidth.Text = Dt_Item.Rows[0]["p_Width"].ToString(); SLP_PHeigh.Text = Dt_Item.Rows[0]["p_height"].ToString(); } else { SLP_SWeight.Text = "0"; SLP_SLength.Text = "0"; SLP_SWidth.Text = "0"; SLP_SHeigh.Text = "0"; SLP_PackNum.Text = "0"; SLP_PWeight.Text = "0"; SLP_PLength.Text = "0"; SLP_PWidth.Text = "0"; SLP_PHeigh.Text = "0"; } GiftBind(); SetClinetFocus(SLPAcceNum.FindControl("TextBoxCode").ClientID); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }
private void ImportData() { try { VGIModel.MaintainAccept dbo = new VGIModel.MaintainAccept(ConntionDB); string PurchaseNo = string.Empty; string Vendor = string.Empty; if (Session["VGI014Detl"] != null) { DataTable dtItem = (DataTable)Session["VGI014Detl"]; Session["MasterOLDData_" + PageTimeStamp.Value] = dtItem; GridView1.DataSource = dtItem; GridView1.DataBind(); Session["VGI014Detl"] = null; Session["VGI012Detl"] = dtItem; if (dtItem.Rows.Count > 0) { dbo.QueryPurchaseMaster(dtItem.Rows[0]["ItemCode"].ToString(), dtItem.Rows[0]["PeriodCode"].ToString(), out PurchaseNo, out Vendor); txtPurNo.Text = PurchaseNo; SLP_Vendor.Text = Vendor; } } if (Session["VGI104Gift"] != null) { DataTable dtGift = (DataTable)Session["VGI104Gift"]; Session["GiftOLDData_" + PageTimeStamp.Value] = dtGift; Session["VGI104Gift"] = null; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }