public List <ProvidersEntity> GetProviders(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientid) { var dal = new StockDAL(); string where = " ClientID='" + clientid + "' and Status<>9"; if (!string.IsNullOrEmpty(keyWords)) { where += " and (Name like '%" + keyWords + "%' or Contact like '%" + keyWords + "%' or MobileTele like '%" + keyWords + "%')"; } DataTable dt = CommonBusiness.GetPagerData("Providers", "*", where, "AutoID", pageSize, pageIndex, out totalCount, out pageCount); List <ProvidersEntity> list = new List <ProvidersEntity>(); foreach (DataRow dr in dt.Rows) { ProvidersEntity model = new ProvidersEntity(); model.FillData(dr); model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault(); list.Add(model); } return(list); }
private static List <Stock> GetStocks(int[] ids, int skip, string startDate, string endDate) { StockDAL stockDAL = new StockDAL(); stockDAL.OpenConnection(GetConnString()); List <Stock> stocks = new List <Stock>(); try { stocks = ListStocksViaList(stockDAL, string.Join(",", ids), startDate, endDate, skip); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { stockDAL.CloseConnection(); } return(stocks); }
public void FillControls() { try { if (dgvlist.Rows.Count > 0) { addtime = Convert.ToDateTime(this.dgvlist[5, this.dgvlist.CurrentCell.RowIndex].Value.ToString()); Stock model = StockDAL.getEntryById <Stock, DateTime>(addtime); txtGoodsName.Text = diclist.ContainsKey(model.GoodsId) ? diclist[model.GoodsId].GoodsName.ToString() : ""; goodsId = model.GoodsId; txtGoodsJhPrice.Text = model.Price.ToString(); txtGoodsNum.Text = model.Num.ToString(); dateTimePickerdate.Value = model.AddTime; dateTimePickerdate.Enabled = false; } } catch (Exception ee) { MessageBox.Show(ee.ToString()); } }
public static StorageDoc GetStorageDetail(string docid, string clientid) { DataSet ds = StockDAL.GetStorageDetail(docid, clientid); StorageDoc model = new StorageDoc(); if (ds.Tables.Contains("Doc") && ds.Tables["Doc"].Rows.Count > 0) { model.FillData(ds.Tables["Doc"].Rows[0]); model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid); model.StatusStr = GetDocStatusStr(model.DocType, model.Status); model.DocTypeStr = CommonBusiness.GetEnumDesc <EnumDocType>((EnumDocType)model.DocType); if (!string.IsNullOrEmpty(model.ExpressID)) { model.Express = ExpressCompanyBusiness.GetExpressCompanyDetail(model.ExpressID); } model.WareHouse = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID); model.Details = new List <StorageDetail>(); foreach (DataRow item in ds.Tables["Details"].Rows) { StorageDetail details = new StorageDetail(); details.FillData(item); if (!string.IsNullOrEmpty(details.UnitID)) { details.UnitName = new ProductsBusiness().GetUnitByID(details.UnitID).UnitName; } if (!string.IsNullOrEmpty(details.ProviderID)) { details.Providers = new ProvidersBusiness().GetProviderByID(details.ProviderID); } model.Details.Add(details); } } return(model); }
public Stock AddNewStock(string argStockCode) { Stock stock = null; if (System.Web.HttpContext.Current.Session["UserId"] != null && DoesUserHaveAccess(UserProvider.GetUserById(System.Web.HttpContext.Current.Session["UserId"].ToString()))) { if (StockProvider.GetStock(argStockCode, System.Web.HttpContext.Current.Session["UserId"].ToString()) == null) { stock = new Stock(argStockCode); StockDAL.SaveStock(argStockCode, System.Web.HttpContext.Current.Session["UserId"].ToString()); } else { throw new Exception("Stock code already exist"); } } else { throw new AuthenticationException("You do not have access! Sorry :("); } return(stock); }
private void BinddgvData() { List <Stock> list = StockDAL.Getlist("采购部", 4, out total); list = list.Where(l => l.EmpId == currentUser.EmpId).ToList(); if (list != null && list.Count > 0) { dgvlist.RowCount = list.Count; for (int i = 0; i < list.Count; i++) { dgvlist[0, i].Value = list[i].GoodsId.ToString(); dgvlist[1, i].Value = diclist.ContainsKey(list[i].GoodsId) ? diclist[list[i].GoodsId].GoodsName.ToString() : ""; dgvlist[2, i].Value = warelist.ContainsKey(list[i].WareId) ? warelist[list[i].WareId].Name.ToString() : ""; dgvlist[3, i].Value = string.IsNullOrEmpty(list[i].Num.ToString()) ? "" : list[i].Num.ToString() + dickeys[diclist[list[i].GoodsId].KeyUnitId].KeyName; dgvlist[4, i].Value = string.IsNullOrEmpty(list[i].Price.ToString()) ? "" : list[i].Price.ToString(); dgvlist[5, i].Value = string.IsNullOrEmpty(list[i].AddTime.ToString()) ? "" : list[i].AddTime.ToString(); } } else { dgvlist.Rows.Clear(); } }
private void tsDelete_Click(object sender, EventArgs e) { int id = getgoodid(); if (MessageBox.Show("确认删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Goods model = GoodsDAL.getEntryById <Goods, long>(id); if (model != null) { List <Stock> stocklist = StockDAL.Getlist("", 20, out id); if (stocklist != null && stocklist.Where(x => x.GoodsId == model.GoodsId).Count() > 0) { MessageBox.Show("库存中还有该商品,不能删除"); return; } else { GoodsDAL.DeleteEntry <Goods, long>(model.GoodsId); MessageBox.Show("删除成功"); BinddgvData(); } } } }
public void Anular(Doc_cabecera_ingreso entity) { try { Delete(entity.id); PrecioDAL precioDAL = new PrecioDAL(); StockDAL stockDAL = new StockDAL(); Stock stock; foreach (var d in entity.listDetalle) { stock = stockDAL.GetByIdProd(d.fk_id_producto); stock.cantidad -= d.cantidad; stockDAL.Update(stock); precioDAL.Delete(d.fk_id_precio); } } catch (Exception ex) { throw ex; } }
public ResultBM Delete(object entity) { try { StockDAL stockDal = new StockDAL(); DonationBLL donationBll = new DonationBLL(); StockBM stockBm = entity as StockBM; if (!stockDal.IsInUse(stockBm.id)) { stockDal.DeleteStock(stockBm.id); donationBll.UpdateToReceivedStatus(stockBm.donation.id); return(new ResultBM(ResultBM.Type.OK, "Se ha eliminado el registro.", stockBm)); } else { return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("STOCK_UNDELETEABLE_ERROR"), stockBm)); } } catch (Exception exception) { return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("DELETING_ERROR") + " " + exception.Message, exception)); } }
public static Stock GetStock(string argStockCode, string argUserId) { return(StockDAL.GetStock(argStockCode, argUserId)); }
public int MaintainGoodsOutStatus(GoodsOutEntity entity, int status, Guid?receiverUserId = null) { return(StockDAL.MaintainGoodsOutStatus(entity, status, receiverUserId)); }
public int InsertGoodsOutDetail(GoodsOutDetailEntity entity, DbTransaction trans) { return(StockDAL.InsertGoodsOutDetail(entity, trans)); }
public List <GoodsOutDetailEntity> GetGoodsOutDetailList(string goodsOutCode) { return(StockDAL.GetGoodsOutDetailList(goodsOutCode)); }
public List <GoodsOutEntity> GetGoodsOutHistoryByReceiver(int receiverStoreId) { return(StockDAL.GetGoodsOutHistoryByReceiver(receiverStoreId)); }
public List <GoodsOutEntity> GetPendingGoodsOutListByReceiver(int receiverStoreId) { return(StockDAL.GetPendingGoodsOutListByReceiver(receiverStoreId)); }
public List <GoodsOutFullInfo> GetGoodsOutListWithArgs(GoodsOutQueryArgs args) { return(StockDAL.GetGoodsOutListWithArgs(args)); }
public List <GoodsOutEntity> GetGoodsOutList(int storeId) { return(StockDAL.GetGoodsOutList(storeId)); }
/// <summary> /// 根据店铺编号获取可发货数量 /// </summary> /// <param name="storeid">店铺编号</param> /// <returns>可发货产品列表</returns> public static DataTable GetLackTotalNumber(string storeid) { return(StockDAL.GetLackTotalNumber(storeid)); }
public IEnumerable <Stock> GetAllStocks() { var stockDL = new StockDAL(); return(stockDL.GetAllStocks()); }
private void BindData() { string sqlstr = string.Empty; bool ishasdate = false; if (string.IsNullOrEmpty(dateTimePickerdate.Text.Trim())) { ishasdate = false; } else { //日期不为空,查日期 ishasdate = true; } if (string.IsNullOrEmpty(cbxQueryType.Text.Trim())) { //日期不为空,查日期 sqlstr = tb_JhGoodsInfoFind(txtKeyWord.Text, 5); } else { switch (cbxQueryType.Text) { case "商品编号": if (ishasdate) { sqlstr = tb_JhGoodsInfoFind(txtKeyWord.Text, 3); } else { sqlstr = tb_JhGoodsInfoFind(txtKeyWord.Text, 1); } break; case "商品名称": if (ishasdate) { sqlstr = tb_JhGoodsInfoFind(txtKeyWord.Text, 4); } else { sqlstr = tb_JhGoodsInfoFind(txtKeyWord.Text, 2); } break; } } List <Stockty> list = StockDAL.queryForList(sqlstr); if (list != null && list.Count > 0) { dgvlist.RowCount = list.Count; for (int i = 0; i < list.Count; i++) { dgvlist[0, i].Value = list[i].GoodsId.ToString(); dgvlist[1, i].Value = string.IsNullOrEmpty(list[i].GoodsName.ToString()) ? "" : list[i].GoodsName.ToString(); dgvlist[2, i].Value = string.IsNullOrEmpty(list[i].WareName.ToString()) ? "" : list[i].WareName.ToString(); dgvlist[3, i].Value = string.IsNullOrEmpty(list[i].Num.ToString()) ? "" : list[i].Num.ToString(); dgvlist[4, i].Value = string.IsNullOrEmpty(list[i].Price.ToString()) ? "" : list[i].Price.ToString(); dgvlist[5, i].Value = string.IsNullOrEmpty(list[i].AddTime.ToString()) ? "" : list[i].AddTime.ToString(); dgvlist[6, i].Value = string.IsNullOrEmpty(list[i].RealName.ToString()) ? "" : list[i].RealName.ToString(); } } else { dgvlist.Rows.Clear(); } }
public int SaveStockData(StockModel JForm) { IStockDAL obj = new StockDAL(); return(obj.SaveStockData(JForm)); }
public string IsChequeNoPresent() { IStockDAL obj = new StockDAL(); return(obj.IsChequeNoPresent()); }
public List <StockEntity> getStockList() { IStockDAL obj = new StockDAL(); return(obj.getStockList()); }
/// <summary> /// 我要发货,订单生成 /// </summary> /// <param name="storeId">店铺编号</param> /// <param name="orderDetails">发货单明细</param> /// <param name="storeItem">发货单信息</param> /// <returns></returns> public Boolean ApplyGoodsSubmit(StoreOrderModel storeorder, string orders) { string orderId = OrderGoodsBLL.GetNewOrderID(); int maxqishu = CommonDataBLL.GetMaxqishu(); //总金额,积分,数量,重量 decimal totalmoney = 0; decimal totalpv = 0; int totalQuantity = 0; decimal totalWeight = 0; string remark = ""; //保存合并后订单明细 IList <OrderDetailModel> orderDetails = new List <OrderDetailModel>(); //获取要合并的订单列表 IList <OrderGoodsMedel> storeorders = StoreOrderDAL.GetOrderGoodsByOrders(orders); //遍历要合并的订单列表 foreach (OrderGoodsMedel order in storeorders) { //获取要合并的订单列表明细并且进行遍历 foreach (OrderDetailModel detail in OrderDetailDAL.GetGoodsDetailModelList(order.OrderGoodsID)) { //判断是否已经有了该产品 int ct = 0; //遍历合并后的订单列表,是否有和要合并的订单重复的产品 foreach (OrderDetailModel orderdetail in orderDetails) { if (orderdetail.ProductId == detail.ProductId) { orderdetail.Quantity += detail.Quantity; ct++;//有重复的累加 } } //没有重复添加新的明细 if (ct == 0) { //生成一条订单明细 OrderDetailModel detailNew = new OrderDetailModel(); detailNew.StoreorderId = orderId; detailNew.ProductId = detail.ProductId; detailNew.Quantity = detail.Quantity; detailNew.Price = detail.Price; detailNew.Pv = detail.Pv; detailNew.StoreId = detail.StoreId; detailNew.ProductName = detail.ProductName; detailNew.ExpectNum = maxqishu; //添加订单明细,到订单明细列表 orderDetails.Add(detailNew); } } //累加总金额,总积分,数量 totalmoney += order.TotalMoney; totalpv += order.TotalPv; totalQuantity += order.GoodsQuantity; totalWeight += order.Weight; remark += order.OrderGoodsID + ";"; } //保存合并后订单 StoreOrderModel storeItem = new StoreOrderModel(); storeItem.StoreId = storeorder.StoreId; //店铺ID storeItem.StoreorderId = orderId; //订单号 storeItem.TotalMoney = totalmoney; //订单总金额 storeItem.TotalPv = totalpv; //订单总积分 storeItem.InceptAddress = storeorder.InceptAddress; //收货人地址 storeItem.InceptPerson = storeorder.InceptPerson; //收货人姓名 storeItem.PostalCode = storeorder.PostalCode; //收货人邮编 storeItem.Telephone = storeorder.Telephone; //收货人电话 storeItem.OrderDatetime = DateTime.Now.ToUniversalTime(); //订单时间 storeItem.ExpectNum = CommonDataBLL.GetMaxqishu(); //获取期数 storeItem.TotalCommision = 0; //手续费 storeItem.GoodsQuantity = totalQuantity; //货物件数 storeItem.Carriage = 0; //运费 storeItem.Weight = totalWeight; //重量 storeItem.City.Country = storeorder.City.Country; //国家 storeItem.City.Province = storeorder.City.Province; //省份 storeItem.City.City = storeorder.City.City; //城市 storeItem.City.Xian = storeorder.City.Xian; storeItem.IscheckOut = "Y"; //是否支付 storeItem.IsAuditing = "Y"; storeItem.SendWay = storeorder.SendWay; storeItem.OperateIP = System.Web.HttpContext.Current.Request.UserHostAddress; //用户IP storeItem.Description = remark; //描述 storeItem.ConsignmentDatetime = DateTime.Now.ToUniversalTime(); //申请发货日期 storeItem.OrderType = storeorder.OrderType; using (SqlConnection conn = new SqlConnection(DBHelper.connString)) { conn.Open(); SqlTransaction tr = conn.BeginTransaction();//开启事务 try { //插入订单 if (new StoreOrderDAL().AddStoreOrder(storeItem, tr)) { //DBHelper.ExecuteNonQuery(tr, "insert into ApplygoodsTb select '" + storeItem.Description + "',1"); //订单表插入成功插入明细表 foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!OrderDetailDAL.AddOrderDetail(tr, orderDetailItem, storeItem.StoreorderId)) { tr.Rollback(); return(false); } } //修改库存信息 foreach (OrderDetailModel orderDetailItem in orderDetails) { if (!StockDAL.UpdStockSendTotalNumber(tr, storeItem.StoreId, orderDetailItem.ProductId, orderDetailItem.Quantity)) { tr.Rollback(); return(false); } } //更新订单发货状态 StoreOrderDAL.UpdateDeliveryFlag(orders, orderId); //if (storeItem.SendType == 2) //{ // string strSql = @"Update memberorder Set sendType = 2 Where OrderId in (Select OutStorageOrderID from OrderGoods where storeorderid in (" + orders + "))"; // DBHelper.ExecuteNonQuery(tr, strSql, null, CommandType.Text); //} tr.Commit();//插入订单信息完成 } else {//订单插入失败回滚数据 tr.Rollback(); return(false); } } catch { //订单插入失败回滚数据 tr.Rollback(); return(false); } finally { conn.Close(); } } return(true); }
private void toolSave_Click(object sender, EventArgs e) { if (getIntCount() == 1) { if (intFalg == 1) { try { ReturnRet <int> result = StockDAL.QueryGoodsNum(sales.GoodsId, sales.Num); if (result.success) { if (SalesDAL.add(sales)) { LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 1, sales.Num, sales.AddTime)); MessageBox.Show("添加成功", "提示"); BinddgvData(); intFalg = 0; ClearControl(); ControlStaus(); } else { MessageBox.Show("添加失败", "提示"); } } else { MessageBox.Show(result.message); intFalg = 1; txtSellGoodsNum.Text = result.data.ToString(); return; } } catch (Exception ex) { MessageBox.Show("添加失败," + ex.Message, "提示"); } } if (intFalg == 2) { //修改 Sales model = SalesDAL.getEntryById <Sales, DateTime>(addtime); if (model == null) { MessageBox.Show("记录不存在", "提示"); } else { ReturnRet <int> result = StockDAL.QueryGoodsNum(sales.GoodsId, sales.Num); if (result.success) { sales.AddTime = model.AddTime; SalesDAL.EditEntry <Sales>(sales, "AddTime"); LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 2, sales.Num - model.Num, DateTime.Now)); MessageBox.Show("修改成功", "提示"); BinddgvData(); } else { MessageBox.Show(result.message); txtSellGoodsNum.Text = result.data.ToString(); intFalg = 2; return; } } intFalg = 0; ClearControl(); ControlStaus(); } if (intFalg == 3) { Sales model = SalesDAL.getEntryById <Sales, DateTime>(addtime); if (model == null) { MessageBox.Show("记录不存在", "提示"); } else { if (MessageBox.Show("确定删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { LogInfoDAL.add(new LogInfo(0, 2, currentUser.EmpId, 3, model.Num, DateTime.Now)); SalesDAL.DeleteEntry <Sales, DateTime>(model.AddTime); MessageBox.Show("删除成功", "提示"); BinddgvData(); } } intFalg = 0; ClearControl(); ControlStaus(); } } }
public int InsertGoodsIn(GoodsInEntity entity, DbTransaction trans) { return(StockDAL.InsertGoodsIn(entity, trans)); }
public static List <Stock> GetStocksByUserId(string argUserId) { return(StockDAL.GetStocksByUserId(argUserId)); }
public List <GoodsInEntity> GetGoodsInList(QueryEntiy entity) { return(StockDAL.GetGoodsInList(entity)); }
public bool UpdateProvider(string providerid, string name, string contact, string mobile, string email, string cityCode, string address, string remark, string operateID, string agentid, string clientID) { var dal = new StockDAL(); return(dal.UpdateProvider(providerid, name, contact, mobile, email, cityCode, address, remark, operateID, agentid, operateID)); }
public List <GoodsInFullInfo> GetGoodsInListForWeb(GoodsOutQueryArgs args) { return(StockDAL.GetGoodsInListForWeb(args)); }