/// <summary>
 /// 用于向 StockWaybillRegister EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToStockWaybillRegister(StockWaybillRegister stockWaybillRegister)
 {
     base.AddObject("StockWaybillRegister", stockWaybillRegister);
 }
Beispiel #2
0
        /// <summary>
        /// 入库登记
        /// </summary>
        public static void InsertStockWaybillRegister(StockWaybillRegister objRegister)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //StockWaybill State 0:已报损报废 1:已使用 2:未使用 3:审核中
                long startCode = long.Parse(objRegister.StartCode);
                long endCode = long.Parse(objRegister.EndCode);
                for (long i = startCode; i <= endCode; i++)
                {
                    string currentCode = i.ToString();
                    StockWaybill objWaybill = context.StockWaybill.FirstOrDefault(obj => obj.Code == currentCode);
                    if (objWaybill != null)
                        throw new Exception(string.Format("运单号[{0}]已存在", currentCode));
                    objWaybill = new StockWaybill();
                    objWaybill.OwnerSite = objRegister.OwnerSite;
                    objWaybill.Code = currentCode;
                    objWaybill.State = "2";
                    objWaybill.Type = "库存";
                    objWaybill.Price = objRegister.Price;
                    context.StockWaybill.AddObject(objWaybill);
                }

                context.StockWaybillRegister.AddObject(objRegister);    //新增入库登记
                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockWaybillAdapter01", Define.Insert, objRegister));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
 /// <summary>
 /// 创建新的 StockWaybillRegister 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="stockDate">StockDate 属性的初始值。</param>
 /// <param name="ownerSite">OwnerSite 属性的初始值。</param>
 /// <param name="startCode">StartCode 属性的初始值。</param>
 /// <param name="endCode">EndCode 属性的初始值。</param>
 /// <param name="number">Number 属性的初始值。</param>
 /// <param name="valid">Valid 属性的初始值。</param>
 public static StockWaybillRegister CreateStockWaybillRegister(global::System.Int32 id, global::System.DateTime stockDate, global::System.String ownerSite, global::System.String startCode, global::System.String endCode, global::System.Int32 number, global::System.Boolean valid)
 {
     StockWaybillRegister stockWaybillRegister = new StockWaybillRegister();
     stockWaybillRegister.ID = id;
     stockWaybillRegister.StockDate = stockDate;
     stockWaybillRegister.OwnerSite = ownerSite;
     stockWaybillRegister.StartCode = startCode;
     stockWaybillRegister.EndCode = endCode;
     stockWaybillRegister.Number = number;
     stockWaybillRegister.Valid = valid;
     return stockWaybillRegister;
 }
Beispiel #4
0
 public void InsertStockWaybillRegister(StockWaybillRegister objRegister)
 {
     StockWaybillAdapter.InsertStockWaybillRegister(objRegister);
 }