public static string MakePickUpBill(string txtBMapControl, string txtEMapControl, string SLP_BLocateControl, string SLP_BLocateSecControl, string SLP_ELocateControl, string SLP_ELocateSecControl, string UserIdControl ) { bool InsertOK = false; string OK = ""; string PickNo = ""; string PickDate = DateTime.Now.ToString("yyyyMMddHHmmss"); try { IVMModel.MaintainPickData BCO = new IVMModel.MaintainPickData(ConntionDB); ParameterList.Clear(); ParameterList.Add(txtBMapControl); ParameterList.Add(txtEMapControl); ParameterList.Add(4); string MapNos = BCO.CheckIsExistByMAPNo(ParameterList); if (MapNos != string.Empty) { return "0|驗收單" + MapNos + "已被用來產生過揀貨單"; } ParameterList.Clear(); ParameterList.Add(UserIdControl); ParameterList.Add(PickDate); ParameterList.Add(txtBMapControl); ParameterList.Add(txtEMapControl); ParameterList.Add(SLP_BLocateControl + SLP_BLocateSecControl); ParameterList.Add(SLP_ELocateControl + SLP_ELocateSecControl); InsertOK = BCO.CreateByStockIn(ParameterList, null, out OK, out PickNo); if (OK == "0") { return "0|查無符合資料"; } else { if (OK == "2") { return "2|" + PickNo; } } return "1|" + PickNo; } catch (Exception ex) { throw ex; } }
protected void btnPrint_Click(object sender, EventArgs e) { SLP_ELocate.Text = this.hid_ESec.Value; string strErr = ""; string UserID = Session["UID"].ToString(); string PickDate = DateTime.Now.ToString("yyyyMMddHHmmss"); string BLocateSec = SLP_BLocate.Text; string ELocateSec = SLP_ELocate.Text; string PickNo = string.Empty; string OK = string.Empty; bool InsertOK = false; TextBox txtBNo = (TextBox)this.SLP_BLocate.FindControl("TextBoxCode"); TextBox txtENo = (TextBox)this.SLP_ELocate.FindControl("TextBoxCode"); TextBox txtESec = (TextBox)this.SLP_ELocate.FindControl("TextBoxCode2"); if (txtBNo.Text == txtENo.Text) { txtESec.Enabled = true; } else { txtESec.Enabled = false; } //檢查儲位不得為空值 if (SLP_ELocate.Text == string.Empty || SLP_ELocate.Text.Length != 6) { strErr = "請輸入正確儲位資料"; ErrorMsgLabel.Text = strErr; return; } //若 [驗收單號起] 及 [驗收單號迄] 只有一個欄位有值,則兩個欄位都填入相同的值 if (txtBMap.Text == string.Empty && txtEMap.Text == string.Empty) { strErr = "請輸入驗收單號"; ErrorMsgLabel.Text = strErr; return; } else { if (txtBMap.Text == string.Empty) { txtBMap.Text = txtEMap.Text; } if (txtEMap.Text == string.Empty) { txtEMap.Text = txtBMap.Text; } } //比較單號號碼 if (txtBMap.Text.Length != 10 && txtEMap.Text.Length != 10) { strErr = "請輸入正確驗收單號"; this.ErrorMsgLabel.Text = strErr; return; } string BMap = txtBMap.Text; string EMap = txtEMap.Text; string BMapNum = BMap.Substring(1, 9); string EMapNum = EMap.Substring(1, 9); int intBMap = 0; int intEMap = 0; if (int.TryParse(BMapNum, out intBMap) == false || int.TryParse(EMapNum, out intEMap) == false) { strErr = "請輸入正確驗收單號"; this.ErrorMsgLabel.Text = strErr; return; } else { if (intBMap > intEMap) { strErr = "單號迄值不可小於單號起值,請重新輸入"; this.ErrorMsgLabel.Text = strErr; return; } } if (SLP_BLocate.Text == SLP_ELocate.Text) { strErr = "上下架儲位不可相同,請重新選擇"; this.ErrorMsgLabel.Text = strErr; return; } txtPickNo.Text = string.Empty; //btnRePrint.Enabled = false; btnMaintain.Enabled = false; try { IVMModel.MaintainPickData BCO = new IVMModel.MaintainPickData(ConntionDB); ParameterList.Clear(); ParameterList.Add(txtBMap.Text); ParameterList.Add(txtEMap.Text); ParameterList.Add(4); string MapNos = BCO.CheckIsExistByMAPNo(ParameterList); if (MapNos != string.Empty) { strErr = "驗收單" + MapNos + "已被用來產生過揀貨單"; ErrorMsgLabel.Text = strErr; return; } ParameterList.Clear(); ParameterList.Add(UserID); ParameterList.Add(PickDate); ParameterList.Add(BMap); ParameterList.Add(EMap); ParameterList.Add(BLocateSec); ParameterList.Add(ELocateSec); InsertOK = BCO.CreateByStockIn(ParameterList, null, out OK, out PickNo); if (OK == "0") { strErr = "查無符合資料"; this.ErrorMsgLabel.Text = strErr; return; } else { //btnPrint.Enabled = false; //btnRePrint.Enabled = true; btnMaintain.Enabled = true; this.txtPickNo.Text = PickNo; if (OK == "2") { strErr = "有商品於下架儲位庫存不足"; this.ErrorMsgLabel.Text = strErr; } } ScriptManager.RegisterStartupScript(this.UpdatePanel1, typeof(UpdatePanel), "IVM155", "DoPrint();", true); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } }