/// <summary> /// 用于向 StockWaybillProvide EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToStockWaybillProvide(StockWaybillProvide stockWaybillProvide) { base.AddObject("StockWaybillProvide", stockWaybillProvide); }
/// <summary> /// 运单发放 /// </summary> public static void InsertStockWaybillProvide(StockWaybillProvide objProvide) { try { LDLLogisticsEntities context = new LDLLogisticsEntities(); //StockWaybill State 0:已报损报废 1:已使用 2:未使用 3:审核中 long startCode = long.Parse(objProvide.StartCode); long endCode = long.Parse(objProvide.EndCode); for (long i = startCode; i <= endCode; i++) { string currentCode = i.ToString(); StockWaybill objWaybill = context.StockWaybill.FirstOrDefault(obj => obj.OwnerSite == objProvide.SrcSite && obj.Code == currentCode); if (objWaybill == null) throw new Exception(string.Format("运单号[{0}]不存在", currentCode)); if (objWaybill.Type == "发放") throw new Exception(string.Format("运单号[{0}]已发放", currentCode)); objWaybill.OwnerSite = objProvide.DestSite; objWaybill.Type = "发放"; objWaybill.State = "2"; //以后要审核,先审核 objWaybill.Price = objProvide.Price; } context.StockWaybillProvide.AddObject(objProvide); //新增物料发放记录 context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockWaybillAdapter03", Define.Insert, objProvide)); //记录日志 context.SaveChanges(); //提交保存 } catch (Exception ex) { throw new FaultException(ex.Message); } }
/// <summary> /// 创建新的 StockWaybillProvide 对象。 /// </summary> /// <param name="id">ID 属性的初始值。</param> /// <param name="provideDate">ProvideDate 属性的初始值。</param> /// <param name="srcSite">SrcSite 属性的初始值。</param> /// <param name="destSite">DestSite 属性的初始值。</param> /// <param name="startCode">StartCode 属性的初始值。</param> /// <param name="endCode">EndCode 属性的初始值。</param> /// <param name="number">Number 属性的初始值。</param> /// <param name="state">State 属性的初始值。</param> /// <param name="valid">Valid 属性的初始值。</param> public static StockWaybillProvide CreateStockWaybillProvide(global::System.Int32 id, global::System.DateTime provideDate, global::System.String srcSite, global::System.String destSite, global::System.String startCode, global::System.String endCode, global::System.Int32 number, global::System.String state, global::System.Boolean valid) { StockWaybillProvide stockWaybillProvide = new StockWaybillProvide(); stockWaybillProvide.ID = id; stockWaybillProvide.ProvideDate = provideDate; stockWaybillProvide.SrcSite = srcSite; stockWaybillProvide.DestSite = destSite; stockWaybillProvide.StartCode = startCode; stockWaybillProvide.EndCode = endCode; stockWaybillProvide.Number = number; stockWaybillProvide.State = state; stockWaybillProvide.Valid = valid; return stockWaybillProvide; }
public void InsertStockWaybillProvide(StockWaybillProvide objProvide) { StockWaybillAdapter.InsertStockWaybillProvide(objProvide); }