protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) { LHStockIn item = e.DataItem as LHStockIn; if (item != null) { if (item.FFlag == 0) { for (int i = 0; i < e.Values.Length; i++) { if (!e.Values[i].ToString().Contains("#@TPL@")) { e.Values[i] = string.Format("<span class=\"{0}\">{1}</span>", "colorred", e.Values[i].ToString().Contains("#@TPL@") ? "已作废" : e.Values[i]); } } } IQueryable <LHStockInDetails> stockInDetails = new StockInDetailsService().Where(p => p.KeyId == item.KeyId && p.FMemo != ""); IQueryable <string> fmeno = from x in stockInDetails select x.FMemo; if (!string.IsNullOrWhiteSpace(item.FMemo)) { e.Values[15] = item.FMemo + "," + string.Join(",", fmeno.ToList()); } else { e.Values[15] = string.Join(",", fmeno.ToList()); } } }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { switch (Actions) { case WebAction.Add: Region1.Title = "添加盘盈单"; txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId); var temp = new LHStockIn { KeyId = txtKeyId.Text, FFlag = 1, FDeleteFlag = 1, //盘盈单 FType = Convert.ToInt32(GasEnumBill.Profit), CreateBy = CurrentUser.AccountName, FDate = txtFDate.SelectedDate, FCompanyId = CurrentUser.AccountComId, FStatus = Convert.ToInt32(GasEnumBillStauts.Add), FProgress = Convert.ToInt32(GasEnumBillStauts.Add), }; //临时写入单据 StockInService.Add(temp); var summary = new JObject { { "FItemCode", "合计" }, { "FQty", 0 }, { "FAmount", 0 } }; Grid1.SummaryData = summary; break; case WebAction.Edit: Region1.Title = "编辑盘盈单"; txtKeyId.Text = KeyId; if (StockIn != null) { txtFMemo.Text = StockIn.FMemo; ddlFCate.SelectedValue = StockIn.FCate; BindDataGrid(); } break; } }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { switch (Actions) { case WebAction.Add: Region1.Title = "添加生产单"; txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId); var temp = new LHStockIn { KeyId = txtKeyId.Text, FFlag = 1, FDeleteFlag = 1, //发货单 FType = Convert.ToInt32(GasEnumBill.Production), CreateBy = CurrentUser.AccountName, FDate = txtFDate.SelectedDate, FCompanyId = CurrentUser.AccountComId, FStatus = Convert.ToInt32(GasEnumBillStauts.Add), FProgress = Convert.ToInt32(GasEnumBillStauts.Add), }; //临时写入单据 StockInService.Add(temp); break; case WebAction.Edit: txtKeyId.Text = KeyId; Region1.Title = "编辑生产单"; if (StockIn != null) { txtFMemo.Text = StockIn.FMemo; ddlFProducer.SelectedValue = StockIn.FProducer; ddlFSurveyor.SelectedValue = StockIn.FSurveyor; ddlWorkShop.SelectedValue = StockIn.FProductionWorkshop; var product = StockInDetailsService.Where( p => p.KeyId == KeyId && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (product != null) { txtFCode.Text = product.FItemCode; txtFQty.Text = product.FQty.ToString(); tbxFBottle.SelectedValue = product.FBottle; txtFBottleQty.Text = product.FBottleQty.ToString(); txtFCostPrice.Text = product.FCostPrice.ToString(); txtFBalance.Text = product.FBalance.ToString(); // var item = new ItemsService().Where( p => p.FCode == txtFCode.Text && p.FCompanyId == CurrentUser.AccountComId) .FirstOrDefault(); if (item != null) { tbxFName.Text = item.FName; } } BindDataGrid(); } break; } }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { switch (Actions) { case WebAction.Add: txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId); Region1.Title = "添加采购单"; txtFT6ExchangeRate.Text = "1"; var temp = new LHStockIn { KeyId = txtKeyId.Text, FFlag = 1, FDeleteFlag = 1, //发货单 FType = Convert.ToInt32(GasEnumBill.Purchase), CreateBy = CurrentUser.AccountName, FDate = txtFDate.SelectedDate, FCompanyId = CurrentUser.AccountComId, FStatus = Convert.ToInt32(GasEnumBillStauts.Add), FProgress = Convert.ToInt32(GasEnumBillStauts.Add), FCate = "供应商" }; //临时写入单据 StockInService.Add(temp); //合计 var summary = new JObject { { "FItemCode", "合计" }, { "FQty", 0 }, { "FAmount", 0 } }; Grid1.SummaryData = summary; break; case WebAction.Edit: Region1.Title = "编辑采购单"; txtKeyId.Text = KeyId; if (StockIn != null) { WebControlHandler.BindObjectToControls(StockIn, SimpleForm1); txtFDate.SelectedDate = StockIn.FDate; tbxFCustomer.Text = StockIn.FName; if (!string.IsNullOrEmpty(StockIn.FDriver)) { ddlFDriver.SelectedValueArray = StockIn.FDriver.Split(','); } if (!string.IsNullOrEmpty(StockIn.FShipper)) { ddlFShipper.SelectedValueArray = StockIn.FShipper.Split(','); } if (!string.IsNullOrEmpty(StockIn.FSupercargo)) { ddlFSupercargo.SelectedValueArray = StockIn.FSupercargo.Split(','); } if (!string.IsNullOrEmpty(StockIn.FSalesman)) { ddlFSalesman.SelectedValueArray = StockIn.FSalesman.Split(','); } ddlSubject.SelectedValue = StockIn.FSubjectCode; ddlFVehicleNum.SelectedValue = StockIn.FVehicleNum; ddlFArea.SelectedValue = StockIn.FArea; ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod; ddlFT6PurchaseType.SelectedValue = StockIn.FT6PurchaseTypeNum; ddlFT6Currency.SelectedValue = StockIn.FT6Currency; ddlT6ReceiveSendType.SelectedValue = StockIn.FT6ReceiveSendTypeNum; tbxFLogisticsNumber.Text = StockIn.FLogisticsNumber; ddlWarehouse.SelectedValue = StockIn.FT6Warehouse; ddlFDistributionPoint.SelectedValue = StockIn.FDistributionPoint; BindDataGrid(); } break; } }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { switch (Actions) { case WebAction.Add: Region1.Title = "添加空瓶回收单"; txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId); var temp = new LHStockIn { KeyId = txtKeyId.Text, FFlag = 1, FDeleteFlag = 1, //空瓶回收单 FType = Convert.ToInt32(GasEnumBill.BottleReturn), CreateBy = CurrentUser.AccountName, FDate = txtFDate.SelectedDate, FCompanyId = CurrentUser.AccountComId, FStatus = Convert.ToInt32(GasEnumBillStauts.Add), FProgress = Convert.ToInt32(GasEnumBillStauts.Add), }; //临时写入单据 StockInService.Add(temp); break; case WebAction.Edit: Region1.Title = "编辑空瓶回收单"; txtKeyId.Text = KeyId; if (StockIn != null) { WebControlHandler.BindObjectToControls(StockIn, SimpleForm1); txtFDate.SelectedDate = StockIn.FDate; tbxFCustomer.Text = StockIn.FName; if (!string.IsNullOrEmpty(StockIn.FDriver)) { ddlFDriver.SelectedValueArray = StockIn.FDriver.Split(','); } if (!string.IsNullOrEmpty(StockIn.FShipper)) { ddlFShipper.SelectedValueArray = StockIn.FShipper.Split(','); } if (!string.IsNullOrEmpty(StockIn.FSupercargo)) { ddlFSupercargo.SelectedValueArray = StockIn.FSupercargo.Split(','); } if (!string.IsNullOrEmpty(StockIn.FSalesman)) { ddlFSalesman.SelectedValueArray = StockIn.FSalesman.Split(','); } ddlFVehicleNum.SelectedValue = StockIn.FVehicleNum; ddlFArea.SelectedValue = StockIn.FArea; ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod; ddlReturn.SelectedValue = StockIn.FClass; ddlDeliveryMethod.SelectedValue = StockIn.FDeliveryMethod; ddlFDistributionPoint.SelectedValue = StockIn.FDistributionPoint; hfdCate.Text = StockIn.FCate; BindDataGrid(); } break; } }
/// <summary> /// 加载页面数据 /// </summary> private void LoadData() { switch (Actions) { case WebAction.Add: txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId); Region3.Title = "添加入库单"; var temp = new LHStockIn { KeyId = txtKeyId.Text, FFlag = 1, FAuditFlag = 1, FDeleteFlag = 1, //发货单 FType = Convert.ToInt32(GasEnumBill.output), CreateBy = CurrentUser.AccountName, FDate = txtFDate.SelectedDate, FCompanyId = CurrentUser.AccountComId, FStatus = Convert.ToInt32(GasEnumBillStauts.Add), FProgress = Convert.ToInt32(GasEnumBillStauts.Add), }; //临时写入单据 StockInService.Add(temp); //合计 var summary = new JObject { { "FItemCode", "合计" }, { "FQty", 0 }, { "FAmount", 0 } }; Grid1.SummaryData = summary; break; case WebAction.Edit: txtKeyId.Text = KeyId; Region3.Title = "编辑入库单"; if (StockIn != null) { WebControlHandler.BindObjectToControls(StockIn, SimpleForm1); txtFDate.SelectedDate = StockIn.FDate; ddlFCate.SelectedValue = StockIn.FCate; ddlFSalesman.SelectedValue = StockIn.FSalesman; ddlFWarehouse.SelectedValue = StockIn.FT6Warehouse; ddlT6ReceiveSendType.SelectedValue = StockIn.FT6ReceiveSendTypeNum; ddlFGroup.SelectedValue = StockIn.FGroup; ddlFDistributionPoint.SelectedValue = StockIn.FDistributionPoint; BindDataGrid(); } break; } }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); bool containue = true; try { foreach (string item in selectIds) { LHStockIn stockOut = StockInService.Where(p => p.KeyId == item).FirstOrDefault(); if (stockOut.FAuditFlag == 1) { containue = false; break; } } if (!containue) { Alert.Show("已审核单据不能删除作废!", MessageBoxIcon.Information); return; } Log(string.Format(@"作废单据号:{0}成功。", selectIds)); // foreach (var ids in selectIds) { var status = new LHBillStatus(); status.FCompanyId = CurrentUser.AccountComId; status.FDeptId = CurrentUser.AccountOrgId; status.FDate = DateTime.Now; status.FOperator = CurrentUser.AccountName; status.FActionName = EnumDescription.GetFieldText(GasEnumBillStauts.Voided); status.KeyId = ids; status.FMemo = string.Format("单据号{0}被{1}作废处理。", ids, CurrentUser.AccountName); GasHelper.AddBillStatus(status); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@KeyId", ids); parms.Add("@companyId", CurrentUser.AccountComId); parms.Add("@Bill", 1); SqlService.ExecuteProcedureNonQuery("proc_DeleteFlag", parms); } StockInService.Update(p => p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHStockIn { FFlag = 0, // FStatus = Convert.ToInt32(GasEnumBillStauts.Voided), // FProgress = Convert.ToInt32(GasEnumBillStauts.Voided) }); //PassCardService.Update(p =>p.FCompanyId == CurrentUser.AccountComId && selectIds.Contains(p.KeyId), p => new LHPassCard //{ // FFlag = 0, // // FStatus = Convert.ToInt32(GasEnumBillStauts.Add), // // FProgress = Convert.ToInt32(GasEnumBillStauts.Add) //}); Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }