/// <summary> /// 新增 /// </summary> public static void InsertWaybillInfo(WaybillInfo waybillInfo, List<WaybillGoods> lstWaybillGoods) { try { LDLLogisticsEntities context = new LDLLogisticsEntities(); //查找运单号是否可用 StockWaybill waybill = context.StockWaybill.FirstOrDefault(obj => obj.OwnerSite == waybillInfo.ConsignorSite && obj.Code == waybillInfo.Code && obj.Type == "发放"); if (waybill == null || waybill.State != "2") throw new FaultException(string.Format("运单号[{0}]{1}!", waybillInfo.Code, waybill != null && waybill.State == "1" ? "已使用" : "未使用")); //运单号设为已使用 waybill.State = "1"; //保存 context.WaybillInfo.AddObject(waybillInfo); foreach (WaybillGoods goods in lstWaybillGoods) context.WaybillGoods.AddObject(goods); context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("WaybillInfoAdapter01", Define.Insert, waybillInfo)); //记录日志 context.SaveChanges(); //提交保存 } catch (Exception ex) { throw new FaultException(ex.Message); } }
/// <summary> /// 创建新的 WaybillInfo 对象。 /// </summary> /// <param name="code">Code 属性的初始值。</param> /// <param name="dispatchType">DispatchType 属性的初始值。</param> /// <param name="settlementType">SettlementType 属性的初始值。</param> /// <param name="consignor">Consignor 属性的初始值。</param> /// <param name="consignorSite">ConsignorSite 属性的初始值。</param> /// <param name="destination">Destination 属性的初始值。</param> /// <param name="destinationSite">DestinationSite 属性的初始值。</param> /// <param name="storageFee">StorageFee 属性的初始值。</param> /// <param name="receiptFee">ReceiptFee 属性的初始值。</param> /// <param name="remoteFee">RemoteFee 属性的初始值。</param> /// <param name="otherFee">OtherFee 属性的初始值。</param> /// <param name="takeTheirFee">TakeTheirFee 属性的初始值。</param> /// <param name="pickUpGoodsFee">PickUpGoodsFee 属性的初始值。</param> /// <param name="deliveryRMBFee">DeliveryRMBFee 属性的初始值。</param> /// <param name="deliveryHKDFee">DeliveryHKDFee 属性的初始值。</param> /// <param name="customsDlearanceFee">CustomsDlearanceFee 属性的初始值。</param> /// <param name="additionalPage">AdditionalPage 属性的初始值。</param> /// <param name="additionalPageFee">AdditionalPageFee 属性的初始值。</param> /// <param name="receivableAmount">ReceivableAmount 属性的初始值。</param> /// <param name="paidAmount">PaidAmount 属性的初始值。</param> /// <param name="paymentFlag">PaymentFlag 属性的初始值。</param> /// <param name="receiptFlag">ReceiptFlag 属性的初始值。</param> public static WaybillInfo CreateWaybillInfo(global::System.String code, global::System.String dispatchType, global::System.String settlementType, global::System.Int32 consignor, global::System.String consignorSite, global::System.Int32 destination, global::System.String destinationSite, global::System.Decimal storageFee, global::System.Decimal receiptFee, global::System.Decimal remoteFee, global::System.Decimal otherFee, global::System.Decimal takeTheirFee, global::System.Decimal pickUpGoodsFee, global::System.Decimal deliveryRMBFee, global::System.Decimal deliveryHKDFee, global::System.Decimal customsDlearanceFee, global::System.Int32 additionalPage, global::System.Decimal additionalPageFee, global::System.Decimal receivableAmount, global::System.Decimal paidAmount, global::System.Boolean paymentFlag, global::System.Boolean receiptFlag) { WaybillInfo waybillInfo = new WaybillInfo(); waybillInfo.Code = code; waybillInfo.DispatchType = dispatchType; waybillInfo.SettlementType = settlementType; waybillInfo.Consignor = consignor; waybillInfo.ConsignorSite = consignorSite; waybillInfo.Destination = destination; waybillInfo.DestinationSite = destinationSite; waybillInfo.StorageFee = storageFee; waybillInfo.ReceiptFee = receiptFee; waybillInfo.RemoteFee = remoteFee; waybillInfo.OtherFee = otherFee; waybillInfo.TakeTheirFee = takeTheirFee; waybillInfo.PickUpGoodsFee = pickUpGoodsFee; waybillInfo.DeliveryRMBFee = deliveryRMBFee; waybillInfo.DeliveryHKDFee = deliveryHKDFee; waybillInfo.CustomsDlearanceFee = customsDlearanceFee; waybillInfo.AdditionalPage = additionalPage; waybillInfo.AdditionalPageFee = additionalPageFee; waybillInfo.ReceivableAmount = receivableAmount; waybillInfo.PaidAmount = paidAmount; waybillInfo.PaymentFlag = paymentFlag; waybillInfo.ReceiptFlag = receiptFlag; return waybillInfo; }
/// <summary> /// 用于向 WaybillInfo EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddToWaybillInfo(WaybillInfo waybillInfo) { base.AddObject("WaybillInfo", waybillInfo); }
public void InsertWaybillInfo(WaybillInfo waybillInfo, List<WaybillGoods> lstWaybillGoods) { WaybillInfoAdapter.InsertWaybillInfo(waybillInfo, lstWaybillGoods); }