/// <summary>
 /// 用于向 StockGoodsProvide EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToStockGoodsProvide(StockGoodsProvide stockGoodsProvide)
 {
     base.AddObject("StockGoodsProvide", stockGoodsProvide);
 }
Exemple #2
0
 public void InsertStockGoodsProvide(StockGoodsProvide objProvide)
 {
     StockGoodsAdapter.InsertStockGoodsProvide(objProvide);
 }
 /// <summary>
 /// 创建新的 StockGoodsProvide 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="provideDate">ProvideDate 属性的初始值。</param>
 /// <param name="srcSite">SrcSite 属性的初始值。</param>
 /// <param name="destSite">DestSite 属性的初始值。</param>
 /// <param name="goods">Goods 属性的初始值。</param>
 /// <param name="number">Number 属性的初始值。</param>
 /// <param name="state">State 属性的初始值。</param>
 /// <param name="valid">Valid 属性的初始值。</param>
 public static StockGoodsProvide CreateStockGoodsProvide(global::System.Int32 id, global::System.DateTime provideDate, global::System.String srcSite, global::System.String destSite, global::System.String goods, global::System.Int32 number, global::System.String state, global::System.Boolean valid)
 {
     StockGoodsProvide stockGoodsProvide = new StockGoodsProvide();
     stockGoodsProvide.ID = id;
     stockGoodsProvide.ProvideDate = provideDate;
     stockGoodsProvide.SrcSite = srcSite;
     stockGoodsProvide.DestSite = destSite;
     stockGoodsProvide.Goods = goods;
     stockGoodsProvide.Number = number;
     stockGoodsProvide.State = state;
     stockGoodsProvide.Valid = valid;
     return stockGoodsProvide;
 }
Exemple #4
0
        /// <summary>
        /// 物料发放
        /// </summary>
        public static void InsertStockGoodsProvide(StockGoodsProvide objProvide)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                StockGoods objGoods = context.StockGoods.FirstOrDefault(obj => obj.OwnerSite == objProvide.SrcSite && obj.Goods == objProvide.Goods);
                if (objGoods == null)
                    throw new Exception("库存记录不存在");
                if (objGoods.Number < objProvide.Number)
                    throw new Exception(string.Format("库存数量({0})不足够", objGoods.Number));
                objGoods.Number -= objProvide.Number;   //更新库存数量

                context.StockGoodsProvide.AddObject(objProvide);    //新增物料发放记录
                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockGoodsAdapter03", Define.Insert, objProvide));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }