/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (StockIn != null) { ModifiedGrid(); StockIn.FSalesman = ddlFSalesman.SelectedValue; StockIn.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; StockIn.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; StockIn.FFreight = 0; StockIn.FLinkman = ""; StockIn.FMemo = txtFMemo.Text.Trim(); StockIn.FT6Warehouse = ddlFWarehouse.SelectedValue; StockIn.FGroup = ddlFGroup.SelectedValue; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", StockIn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesReturnAmt", parms).Tables[0].Rows[0][0]); StockIn.FAmount = amt; StockIn.FDate = txtFDate.SelectedDate; StockIn.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockIn.FCate = ddlFCate.SelectedValue; //StockIn.CreateBy = CurrentUser.AccountName; return(StockInService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (StockIn != null) { ModifiedGrid(); StockIn.FCompanyId = CurrentUser.AccountComId; StockIn.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockIn.FMemo = txtFMemo.Text.Trim(); StockIn.FDate = txtFDate.SelectedDate; var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", StockIn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); StockIn.FAmount = amt; StockIn.CreateBy = CurrentUser.AccountName; return(StockInService.SaveChanges() >= 0); } return(false); }
/// <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; } }
public delegateController(IManageRepository _manageRepository, IBomRepository _bomrepository, IPurchaseRepository _bomRepository, IStockInRepository _stockinrepository, IStockOutRepository _stockoutrepository) { manageService = new ManageService(_manageRepository); bomService = new BomService(_bomrepository); stockoutService = new StockOutService(_stockoutrepository); stockinService = new StockInService(_stockinrepository); purchaseService = new PurchaseService(_bomRepository); }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (StockIn != null) { ModifiedGrid(); StockIn.FCate = "内部"; StockIn.FCode = CurrentUser.AccountComId.ToString(CultureInfo.InvariantCulture); StockIn.FName = ""; StockIn.FMemo = txtFMemo.Text.Trim(); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", StockIn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); StockIn.FAmount = amt; StockIn.FBatchNumber = txtFBatchNumber.Text.Trim(); StockIn.FSurveyor = !ddlFSurveyor.SelectedValue.Equals("-1") ? ddlFSurveyor.SelectedText : ""; StockIn.FProducer = !ddlFProducer.SelectedValue.Equals("-1") ? ddlFProducer.SelectedText : "";//GasHelper.GetDropDownListArrayString(ddlFProducer.SelectedItemArray); StockIn.FProductionWorkshop = ddlWorkShop.SelectedValue; StockIn.FDate = txtFDate.SelectedDate; StockIn.CreateBy = CurrentUser.AccountName; StockInService.SaveChanges(); var prod = StockInDetailsService.FirstOrDefault( p => p.KeyId == txtKeyId.Text && p.FCompanyId == CurrentUser.AccountComId); if (prod != null) { prod.FItemCode = txtFCode.Text; prod.FQty = Convert.ToDecimal(txtFQty.Text); prod.FBottle = tbxFBottle.SelectedValue; prod.FBottleQty = Convert.ToInt16(txtFBottleQty.Text); prod.FCostPrice = Convert.ToDecimal(txtFCostPrice.Text); prod.FBalance = Convert.ToDecimal(txtFBalance.Text); prod.FCostPrice = Convert.ToDecimal(txtFCostPrice.Text); prod.FBalance = Convert.ToDecimal(txtFBalance.Text); StockInDetailsService.SaveChanges(); } var orders = new Dictionary <string, object>(); orders.Clear(); orders.Add("@KeyId", StockIn.KeyId); orders.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_ProuctOrder", orders); return(true); } return(false); }
public mainController(IAccountRepository _accountRepository, IManageRepository _manageRepository, IPurchaseRepository _purchaseRepository, IStockInRepository _stockinrepository, IStockOutRepository _stockoutrepository, IBomRepository _bomrepository) { accountService = new AccountService(_accountRepository); purchaseService = new PurchaseService(_purchaseRepository); stockinService = new StockInService(_stockinrepository); stockoutService = new StockOutService(_stockoutrepository); manageService = new ManageService(_manageRepository); bomService = new BomService(_bomrepository); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim()).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FCompanyId = CurrentUser.AccountComId; stock.FDeleteFlag = 0; stock.FMemo = txtFMemo.Text.Trim(); stock.FDate = txtFDate.SelectedDate; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; 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; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PY", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "10"); 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); } return(true); } return(false); }
public void FillInventoryDataGridView(DataGridView dgv) //To be moved to ServiceFacade { StockInService employeeService = new StockInService(); var InventoryList = employeeService.GetInventoryList(); dgv.DataSource = InventoryList; dgv.ReadOnly = true; dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgv.DefaultCellStyle.SelectionBackColor = Color.Gray; }
// 根据serial nuber读取入库信息 private void btnReadStockIn_Click(object sender, EventArgs e) { string serialNumber = txtSerialNumber.Text; stockIn = StockInService.GetBySerialNumber(serialNumber); IList <Product> products = ProductService.GetProductsBuStockIn(stockIn); dgProducts.DataSource = products; }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (StockIn != null) { ModifiedGrid(); StockIn.FCode = txtFCode.Text; StockIn.FName = tbxFCustomer.Text; StockIn.FAddress = txtFAddress.Text.Trim(); StockIn.FCompanyId = CurrentUser.AccountComId; StockIn.FDistributionPoint = ddlFDistributionPoint.SelectedValue; //StockIn.FDriver = !ddlFDriver.SelectedValue.Equals("-1") ? ddlFDriver.SelectedText : ""; StockIn.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; //StockIn.FSupercargo = !ddlFSupercargo.SelectedValue.Equals("-1") ? ddlFSupercargo.SelectedText : ""; StockIn.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; StockIn.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; StockIn.FFlag = 1; StockIn.FFreight = 0;//Convert.ToDecimal(txtFFreight.Text.Trim()); StockIn.FLinkman = txtFLinkman.Text.Trim(); StockIn.FMemo = txtFMemo.Text.Trim(); StockIn.FPhone = txtFPhone.Text.Trim(); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", StockIn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesReturnAmt", parms).Tables[0].Rows[0][0]); StockIn.FAmount = amt; StockIn.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); StockIn.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); StockIn.FClass = ddlReturn.SelectedValue; LHCustomer custmernodel = new CustomerService().FirstOrDefault(p => p.FCode == txtFCode.Text.Trim()); if (custmernodel != null) { hfdCate.Text = "客户"; } else { hfdCate.Text = "供应商"; } StockIn.FCate = hfdCate.Text; StockIn.CreateBy = CurrentUser.AccountName; StockIn.FDate = txtFDate.SelectedDate; return(StockInService.SaveChanges() >= 0); } return(false); }
/// <summary> /// 作废 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnBatchDelete_Click(object sender, EventArgs e) { IEnumerable <string> selectIds = GetSelectIds(); try { 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", 6); 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) }); Alert.Show("作废成功!", MessageBoxIcon.Information); BindDataGrid(); } catch (Exception) { Alert.Show("作废失败!", MessageBoxIcon.Warning); } }
/// <summary> /// 绑定数据表格 /// </summary> private void BindDataGrid() { int output; dynamic orderingSelector; Expression <Func <LHStockIn, bool> > predicate = BuildPredicate(out orderingSelector); //取数据源 IQueryable <LHStockIn> list = StockInService.Where(predicate, Grid1.PageSize, Grid1.PageIndex + 1, orderingSelector, EnumHelper.ParseEnumByString <OrderingOrders>(SortDirection), out output); //设置页面大小 Grid1.RecordCount = output; //绑定数据源 Grid1.DataSource = list; Grid1.DataBind(); ddlPageSize.SelectedValue = Grid1.PageSize.ToString(CultureInfo.InvariantCulture); }
/// <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: 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 bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FSalesman = ddlFSalesman.SelectedValue; stock.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; stock.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; stock.FFreight = 0; stock.FLinkman = ""; stock.FMemo = txtFMemo.Text.Trim(); stock.FT6Warehouse = ddlFWarehouse.SelectedValue; stock.FT6Status = "未同步"; stock.FGroup = ddlFGroup.SelectedValue; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; 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_SalesReturnAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FDate = txtFDate.SelectedDate; stock.FCate = ddlFCate.SelectedValue; stock.FTime1 = DateTime.Now; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "IN", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "21"); 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}新增{2}单据。", newKeyId, CurrentUser.AccountName, ddlFCate.SelectedValue) }; GasHelper.AddBillStatus(billStatus); } return(true); } return(false); }
public StockInManager(int connectorId) { service = base.CreateService(typeof(StockInService), connectorId) as StockInService; }
/// <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); }
/// <summary> /// 提交编辑 /// </summary> private bool SubmintEdit() { if (StockIn != null) { ModifiedGrid(); //StockIn.FClass = ddlFCate.SelectedValue; StockIn.FCode = txtFCode.Text; StockIn.FName = tbxFCustomer.Text; StockIn.FAddress = txtFAddress.Text.Trim(); StockIn.FCompanyId = CurrentUser.AccountComId; StockIn.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; StockIn.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : ""; StockIn.FFlag = 1; if (!string.IsNullOrEmpty(txtFFreight.Text.Trim())) { StockIn.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim()); } StockIn.FLinkman = txtFLinkman.Text.Trim(); StockIn.FMemo = txtFMemo.Text.Trim(); StockIn.FPhone = txtFPhone.Text.Trim(); var parms = new Dictionary <string, object>(); parms.Clear(); parms.Add("@keyID", StockIn.KeyId); parms.Add("@companyId", CurrentUser.AccountComId); var amt = Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_PurchaseAmt", parms).Tables[0].Rows[0][0]); StockIn.FAmount = amt; StockIn.FDate = txtFDate.SelectedDate; StockIn.FSalesman = ddlFSalesman.SelectedValue; StockIn.FArea = ddlFArea.SelectedValue; StockIn.FAmt = string.IsNullOrEmpty(txtFAmt.Text.Trim()) ? 0 : Convert.ToDecimal(txtFAmt.Text.Trim()); StockIn.FReconciliation = txtFReconciliation.Text; StockIn.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; StockIn.FLogisticsNumber = tbxFLogisticsNumber.Text; StockIn.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); StockIn.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); StockIn.FSubjectCode = ddlSubject.SelectedValue; StockIn.FSubjectName = ddlSubject.SelectedText; //StockIn.CreateBy = CurrentUser.AccountName; //--------------------------------------------------------- //收发类型 StockIn.FT6ReceiveSendType = ddlT6ReceiveSendType.SelectedText; StockIn.FT6ReceiveSendTypeNum = ddlT6ReceiveSendType.SelectedValue; //部门名称 StockIn.FT6Department = ""; //部门代码 StockIn.FT6DepartmentNum = ""; //业务员代码 StockIn.FT6SalesmanNum = ""; //币种 StockIn.FT6Currency = ddlFT6Currency.SelectedValue; //汇率 StockIn.FT6ExchangeRate = Convert.ToDecimal(txtFT6ExchangeRate.Text); //销售类型 StockIn.FT6PurchaseType = ddlFT6PurchaseType.SelectedText; StockIn.FT6PurchaseTypeNum = ddlFT6PurchaseType.SelectedValue; //T6同步 //StockOut.FT6Status = "未同步"; StockIn.FT6Warehouse = ddlWarehouse.SelectedValue; StockIn.FDistributionPoint = ddlFDistributionPoint.SelectedValue; StockInService.SaveChanges(); //付款部分 var parmsAuto = new Dictionary <string, object>(); parmsAuto.Clear(); parmsAuto.Add("@KeyId", StockIn.KeyId); parmsAuto.Add("@companyId", CurrentUser.AccountComId); parmsAuto.Add("@FCate", "供应商"); parmsAuto.Add("@date", Convert.ToDateTime(StockIn.FDate).ToShortDateString()); parmsAuto.Add("@FSKNum", string.IsNullOrEmpty(StockIn.FSKNum) ? "" : StockIn.FSKNum); SqlService.ExecuteProcedureCommand("proc_FKOrderAuto", parmsAuto); return(true); } return(false); }
/// <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: 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> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); stock.FCode = txtFCode.Text; stock.FName = tbxFCustomer.Text; stock.FAddress = txtFAddress.Text.Trim(); stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FFreight = 0;// Convert.ToDecimal(txtFFreight.Text.Trim()); stock.FLinkman = txtFLinkman.Text.Trim(); stock.FMemo = txtFMemo.Text.Trim(); stock.FPhone = txtFPhone.Text.Trim(); //stock.FDriver = !ddlFDriver.SelectedValue.Equals("-1") ? ddlFDriver.SelectedText : ""; stock.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : ""; //stock.FSupercargo = !ddlFSupercargo.SelectedValue.Equals("-1") ? ddlFSupercargo.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_SalesReturnAmt", parms).Tables[0].Rows[0][0]); stock.FAmount = amt; stock.FReconciliation = txtFReconciliation.Text; stock.FDeliveryMethod = ddlDeliveryMethod.SelectedValue; stock.FLogisticsNumber = txtFLogisticsNumber.Text; stock.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray); stock.FDriver = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray); stock.FClass = ddlReturn.SelectedValue; LHCustomer custmernodel = new CustomerService().FirstOrDefault(p => p.FCode == txtFCode.Text.Trim()); if (custmernodel != null) { hfdCate.Text = "客户"; } else { hfdCate.Text = "供应商"; } stock.FCate = hfdCate.Text; stock.FDate = txtFDate.SelectedDate; stock.FDistributionPoint = ddlFDistributionPoint.SelectedValue; stock.FTime1 = DateTime.Now; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "HK", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "13"); 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); } return(true); } return(false); }
/// <summary> /// 提交添加 /// </summary> private bool SubmintAdd() { var stock = StockInService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault(); if (stock != null) { ModifiedGrid(); var prod = StockInDetailsService.FirstOrDefault( p => p.KeyId == txtKeyId.Text && p.FCompanyId == CurrentUser.AccountComId); if (prod == null) { //生产产品入库 var product = new LHStockInDetails { KeyId = txtKeyId.Text, FItemCode = txtFCode.Text, FPrice = 0, FAmount = 0, FQty = Convert.ToDecimal(txtFQty.Text), FBottle = tbxFBottle.SelectedValue, FBottleQty = Convert.ToInt16(txtFBottleQty.Text), FBottleOweQty = 0, FCompanyId = CurrentUser.AccountComId, FCateId = 2000, FMemo = "生产入库", FCostPrice = Convert.ToDecimal(txtFCostPrice.Text), FBalance = Convert.ToDecimal(txtFBalance.Text), }; StockInDetailsService.Add(product); } else { prod.FItemCode = txtFCode.Text; prod.FQty = Convert.ToDecimal(txtFQty.Text); prod.FBottle = tbxFBottle.SelectedValue; prod.FBottleQty = Convert.ToInt32(txtFBottleQty.Text); prod.FCostPrice = Convert.ToDecimal(txtFCostPrice.Text); prod.FBalance = Convert.ToDecimal(txtFBalance.Text); StockInDetailsService.SaveChanges(); } //------------------------------------------------------------------- stock.FCompanyId = CurrentUser.AccountComId; stock.FFlag = 1; stock.FDeleteFlag = 0; stock.FMemo = txtFMemo.Text.Trim(); 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.FSurveyor = !ddlFSurveyor.SelectedValue.Equals("-1") ? ddlFSurveyor.SelectedText : ""; stock.FProducer = !ddlFProducer.SelectedValue.Equals("-1") ? ddlFProducer.SelectedText : "";//GasHelper.GetDropDownListArrayString(ddlFProducer.SelectedItemArray); stock.FBatchNumber = txtFBatchNumber.Text.Trim(); stock.FProductionWorkshop = ddlWorkShop.SelectedValue; stock.FCate = "内部"; stock.FCode = CurrentUser.AccountComId.ToString(CultureInfo.InvariantCulture); stock.FName = ""; stock.FDate = txtFDate.SelectedDate; StockInService.SaveChanges(); if (txtKeyId.Text.Contains("TM")) { //单据号问题 string newKeyId = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "PR", CurrentUser.AccountComId); var orderParms = new Dictionary <string, object>(); orderParms.Clear(); orderParms.Add("@oldKeyId", txtKeyId.Text); orderParms.Add("@newKeyId", newKeyId); orderParms.Add("@Bill", "6"); orderParms.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_num", orderParms); txtKeyId.Text = newKeyId; var orders = new Dictionary <string, object>(); orders.Clear(); orders.Add("@KeyId", newKeyId); orders.Add("@companyId", CurrentUser.AccountComId); SqlService.ExecuteProcedureCommand("proc_ProuctOrder", orders); //新增日志 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); } return(true); } return(false); }
protected void btnSubmit_Click(object sender, EventArgs e) { bool isSucceed = false; try { switch (Actions) { case WebAction.Add: isSucceed = SubmintAdd(); break; case WebAction.Edit: isSucceed = SubmintEdit(); break; } tmsModel t = new tmsModel(); try { IQueryable <LHDispatchCenter> center = DispatchCenterService.Where(p => p.KeyId == lblKeyId.Text); if (center.Count() > 0) { t.dispatchCenterList = center.ToList(); } IQueryable <LHStockOut> iP = new StockOutService().Where(p => p.FDispatchNum == lblKeyId.Text); t.stockOutList = iP.ToList <LHStockOut>(); t.stockOutDetailsList = new List <LHStockOutDetails>(); foreach (LHStockOut item in iP) { IQueryable <LHStockOutDetails> li = new StockOutDetailsService().Where(p => p.KeyId == item.KeyId); foreach (LHStockOutDetails outDetails in li) { t.stockOutDetailsList.Add(outDetails); } } IQueryable <LHPassCard> lHPasses = PassCardService.Where(p => p.FDispatchNum == lblKeyId.Text); if (lHPasses != null) { t.passCardList = lHPasses.ToList(); } t.passCardDetailsList = new List <LHPassCardDetails>(); foreach (LHPassCard item in t.passCardList) { IQueryable <LHPassCardDetails> cardDetails = new PassCardDetailsService().Where(p => p.KeyId == item.KeyId); foreach (LHPassCardDetails details in cardDetails) { t.passCardDetailsList.Add(details); } } IQueryable <LHStockIn> skin = new StockInService().Where(p => p.FDispatchNum == lblKeyId.Text); if (skin != null && skin.Count() > 0) { t.stockInList = skin.ToList(); t.stockInDetailsList = new List <LHStockInDetails>(); foreach (LHStockIn item in skin) { IQueryable <LHStockInDetails> inDetails = new StockInDetailsService().Where(p => p.KeyId == item.KeyId); foreach (LHStockInDetails inDetail in inDetails) { t.stockInDetailsList.Add(inDetail); } } } new HttpRequest().httpRequest(t, "open/dbo/dboData"); } catch (Exception) { } } catch (DbEntityValidationException ex) { string msg = string.Empty; List <ICollection <DbValidationError> > errors = (from u in ex.EntityValidationErrors select u.ValidationErrors).ToList(); foreach (ICollection <DbValidationError> item in errors) { msg += item.FirstOrDefault().ErrorMessage; } isSucceed = false; } finally { if (isSucceed) { PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { Alert.Show("提交失败!", MessageBoxIcon.Error); } } }
public manageController(IManageRepository _manageRepository, IStockInRepository _stockinrepository) { manageService = new ManageService(_manageRepository); stockinService = new StockInService(_stockinrepository); }