protected void tbxFLogisticsNumber_OnTextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(tbxFLogisticsNumber.Text.Trim())) { var passCard = PassCardService.Where(p => p.KeyId == tbxFLogisticsNumber.Text.Trim()).FirstOrDefault(); if (passCard != null) { //ddlDeliveryMethod.SelectedValue = "配送";// txtFCode.Text = passCard.FCode; tbxFCustomer.Text = passCard.FName; txtFMemo.Text = passCard.FMemo; txtFLinkman.Text = passCard.FLinkman; txtFPhone.Text = passCard.FPhone; txtFAddress.Text = passCard.FAddress; var dis = new DispatchCenterService().Where(p => p.KeyId == passCard.FDispatchNum).FirstOrDefault(); if (dis != null) { if (!string.IsNullOrEmpty(dis.FDriver)) { ddlFDriver.SelectedValueArray = dis.FDriver.Split(','); } //if (!string.IsNullOrEmpty(passCard.FShipper)) // ddlFShipper.SelectedValueArray = passCard.FShipper.Split(','); if (!string.IsNullOrEmpty(dis.FSupercargo)) { ddlFSupercargo.SelectedValueArray = dis.FSupercargo.Split(','); } //if (!string.IsNullOrEmpty(StockOut.FSalesman)) // ddlFSalesman.SelectedValueArray = passCard.FSalesman.Split(','); ddlFVehicleNum.SelectedValue = dis.FVehicleNum; } var pamrs = new Dictionary <string, object>(); pamrs.Clear(); pamrs.Add("@FCode", passCard.FCode); pamrs.Add("@SalesKeyId", txtKeyId.Text.Trim()); pamrs.Add("@FCompanyId", CurrentUser.AccountComId); pamrs.Add("@KeyId", tbxFLogisticsNumber.Text.Trim()); SqlService.ExecuteProcedureCommand("proc_PassCardToPurchase", pamrs); BindDataGrid(); } } }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); //stock.FClass = ddlFCate.SelectedValue; stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; stock.FAddress = txtFAddress.Text.Trim(); stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; if (!string.IsNullOrEmpty(txtFFreight.Text.Trim())) { stock.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); } stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; stock.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", stock.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FDate = txtFDate.SelectedDate; stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = tbxFLogisticsNumber.Text; stock.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim()); stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FSubjectCode = ddlSubject.SelectedValue; stock.FSubjectName = ddlSubject.SelectedText; stock.FDate = txtFDate.SelectedDate; #region T6 对接接口 //--------------------------------------------------------- //收发类型 stock.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; //部门名称 stock.FT6Department = ""; //部门代码 stock.FT6DepartmentNum = ""; //业务员代码 stock.FT6SalesmanNum = ""; //币种 stock.FT6Currency = ddlFT6Currency.SelectedValue; //汇率 stock.FT6ExchangeRate = Convert.ToDecimal(txtFT6ExchangeRate.Text); //销售类型 stock.FT6PurchaseType = ddlFT6PurchaseType.SelectedText; stock.FT6PurchaseTypeNum = ddlFT6PurchaseType.SelectedValue; //T6同步 stock.FT6Status = "未同步"; stock.FT6Warehouse = ddlWarehouse.SelectedValue; //--------------------------------------------------------- #endregion stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockInService.SaveChanges(); //订单出库 var passCard = PassCardService.Where(p => p.KeyId == tbxFLogisticsNumber.Text.Trim()).FirstOrDefault(); if (passCard != null) { passCard.FOutFlag = "已出库"; PassCardService.SaveChanges(); } if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "WC", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "4"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; //新增日志 var billStatus = new LHBillStatus { KeyId = newKeyId, FCompanyId = CurrentUser.AccountComId, FActionName = "新增", FDate = DateTime.Now, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FMemo = String.Format("单据号{0},{1}新增采购单据。", newKeyId, CurrentUser.AccountName) }; GasHelper.AddBillStatus(billStatus); //付款部分 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", newKeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", "供应商"); parmsAuto.Add("@date", Convert.ToDateTime(stock.FDate).ToString("yyyy-MM-dd")); parmsAuto.Add("@FSKNum", string.IsNullOrEmpty(stock.FSKNum) ? "" : stock.FSKNum); SqlService.ExecuteProcedureCommand("proc_FKOrderAuto", parmsAuto); } return(true); } return(false); }