/// <summary> /// 保存 /// </summary> /// <param name="item"></param> public void Save(SaleOrderGoodsSettlementInfo item) { if (item == null) { return; } try { _saleOrderGoodsSettlementDal.Save(item); } catch (Exception ex) { ERP.SAL.LogCenter.LogService.LogError(string.Format("保存销售订单商品结算价失败!公司ID {0},主商品ID {1},关联单据号 {2}", item.FilialeId, item.GoodsId, item.RelatedTradeNo), LOG_TAG, ex); } }
public void Save(SaleOrderGoodsSettlementInfo info) { if (info == null) { return; } const string SQL = @" if not exists(select top 1 1 from SaleOrderGoodsSettlement where RelatedTradeNo=@RelatedTradeNo and GoodsId=@GoodsId) begin INSERT INTO [SaleOrderGoodsSettlement] ([FilialeId] ,[GoodsId] ,[SettlementPrice] ,[RelatedTradeType] ,[RelatedTradeNo] ,[OccurTime] ,[CreateTime]) VALUES (@FilialeId ,@GoodsId ,@SettlementPrice ,@RelatedTradeType ,@RelatedTradeNo ,@OccurTime ,getdate()) end "; using (SqlConnection conn = Databases.GetSqlConnection(GlobalConfig.ERP_DB_NAME, false)) { conn.Execute(SQL, new { FilialeId = info.FilialeId, GoodsId = info.GoodsId, SettlementPrice = info.SettlementPrice, RelatedTradeType = info.RelatedTradeType, RelatedTradeNo = info.RelatedTradeNo, OccurTime = info.OccurTime, }); } }