예제 #1
0
 /// <summary>
 /// 创建新的 StockWaybill 对象。
 /// </summary>
 /// <param name="code">Code 属性的初始值。</param>
 /// <param name="ownerSite">OwnerSite 属性的初始值。</param>
 /// <param name="state">State 属性的初始值。</param>
 /// <param name="type">Type 属性的初始值。</param>
 public static StockWaybill CreateStockWaybill(global::System.String code, global::System.String ownerSite, global::System.String state, global::System.String type)
 {
     StockWaybill stockWaybill = new StockWaybill();
     stockWaybill.Code = code;
     stockWaybill.OwnerSite = ownerSite;
     stockWaybill.State = state;
     stockWaybill.Type = type;
     return stockWaybill;
 }
예제 #2
0
 /// <summary>
 /// 用于向 StockWaybill EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToStockWaybill(StockWaybill stockWaybill)
 {
     base.AddObject("StockWaybill", stockWaybill);
 }
예제 #3
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);
            }
        }