/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { //生成调度单 LHDispatchCenter dispatch = new LHDispatchCenter(); //调度单号生成 string newKeyId = SequenceService.CreateSequence("PC", CurrentUser.AccountComId); dispatch.KeyId = newKeyId; lblKeyId.Text = newKeyId; dispatch.FCompanyId = CurrentUser.AccountComId; dispatch.FBeginDate = dptBeginDate.SelectedDate; dispatch.FBeginTime = dpBeginTime.Text.Trim(); dispatch.FEndDate = dptEnd.SelectedDate; dispatch.FEndTime = dpEndTime.Text.Trim(); dispatch.FDate = DateTime.Now; dispatch.FVehicleNum = ddlFVehicleNum.SelectedValue; dispatch.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); dispatch.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); dispatch.CreateBy = CurrentUser.AccountName; dispatch.FFlag = 1; dispatch.FLogistics = ddlLogistics.SelectedText; dispatch.FLogisticsCode = ddlLogistics.SelectedValue; dispatch.FActual = string.IsNullOrEmpty(txtFActual.Text.Trim()) ? 0M : Convert.ToDecimal(txtFActual.Text.Trim()); dispatch.FTrailerPlate = ddlFTrailerPlate.SelectedValue; dispatch.FFrom = ddlFrom.SelectedValue; dispatch.FTo = ddlTo.SelectedValue; dispatch.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; dispatch.FAuditFlag = 0; DispatchCenterService.Add(dispatch); string[] keys = KeyId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); string[] patch = patchid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string key in keys) { if (!string.IsNullOrEmpty(key)) { //状态 LHBillStatus flow = new LHBillStatus { KeyId = key, FCompanyId = CurrentUser.AccountComId, FDeptId = CurrentUser.AccountOrgId, FOperator = CurrentUser.AccountName, FDate = Convert.ToDateTime(dptBeginDate.SelectedDate), FActionName = "配车", FMemo = string.Format(@"单据号{0}被{1}作配车业务处理。", key, CurrentUser.AccountName) }; BillStatusService.Add(flow); LHStockOut info = new StockOutService().FirstOrDefault(p => p.KeyId == key && p.FCompanyId == CurrentUser.AccountComId); if (info != null) { Dictionary <string, object> infoParms = new Dictionary <string, object>(); infoParms.Clear(); infoParms.Add("@keyid", info.FLogisticsNumber); infoParms.Add("@companyId", CurrentUser.AccountComId); infoParms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue); infoParms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray)); infoParms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray)); infoParms.Add("@FDispatchNum", newKeyId); //调度单号 SqlService.ExecuteProcedureCommand("proc_DispatchCenter", infoParms); } //变更单据上的司机、押韵员、车牌号 Dictionary <string, object> parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyid", key); parms.Add("@companyId", CurrentUser.AccountComId); parms.Add("@FVehicleNum", ddlFVehicleNum.SelectedValue); parms.Add("@FDriver", GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray)); parms.Add("@FSupercargo", GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray)); parms.Add("@FDispatchNum", newKeyId); //调度单号 SqlService.ExecuteProcedureCommand("proc_DispatchCenter", parms); List <LHStockOut> outs = new List <LHStockOut>(); List <LHPassCard> cards = new List <LHPassCard>(); } } foreach (var item in patch) { LHStockOutDispatch dis = StockoutDispatchServices.Where(p => p.KeyId == item).FirstOrDefault(); if (dis != null) { dis.FState = 1; StockoutDispatchServices.SaveChanges(); } } return(true); }