海运出口保存回写商品信息

dev
cjy 3 months ago
parent 047ee81907
commit 313c3633d6

@ -1,5 +1,6 @@
using AngleSharp.Dom; using AngleSharp.Dom;
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Constants;
using DS.Module.Core.Data; using DS.Module.Core.Data;
using DS.Module.Core.Extensions; using DS.Module.Core.Extensions;
using DS.Module.DjyRulesEngine; using DS.Module.DjyRulesEngine;
@ -252,6 +253,12 @@ public partial class SeaExportService : ISeaExportService
data.StlDate = stlInfo.Data.StlDate; data.StlDate = stlInfo.Data.StlDate;
data.AccountDate = stlInfo.Data.AccountDate; data.AccountDate = stlInfo.Data.AccountDate;
#endregion #endregion
#region 回写商品信息
var goodid = WriteBackGoods(data, tenantDb);
data.GoodsId = goodid;
#endregion
//判断是否订阅运踪目的港起运港标识 //判断是否订阅运踪目的港起运港标识
if (!string.IsNullOrEmpty(data.MBLNO)) if (!string.IsNullOrEmpty(data.MBLNO))
{ {
@ -375,6 +382,11 @@ public partial class SeaExportService : ISeaExportService
#endregion #endregion
#region 回写商品信息
var goodid = WriteBackGoods(info, tenantDb);
info.GoodsId = goodid;
#endregion
//判断是否订阅运踪目的港起运港标识 //判断是否订阅运踪目的港起运港标识
if (!string.IsNullOrEmpty(info.MBLNO)) if (!string.IsNullOrEmpty(info.MBLNO))
{ {
@ -482,6 +494,40 @@ public partial class SeaExportService : ISeaExportService
} }
} }
/// <summary>
/// 回写商品信息
/// </summary>
/// <param name="seaExport"></param>
/// <param name="sqlSugarScope"></param>
/// <returns></returns>
public long WriteBackGoods(SeaExport seaExport, SqlSugarScopeProvider sqlSugarScope) {
if (seaExport.GoodsId == 0)
{
var data = new CodeGoods()
{
GoodsCode = seaExport.HSCode,
GoodName = seaExport.GoodsName,
HSCode = seaExport.HSCode
};
var entity = sqlSugarScope.Insertable(data).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").ExecuteReturnEntityAsync();
seaExport.GoodsId = entity.Id;
return entity.Id;
}
else
{
var info = sqlSugarScope.Queryable<CodeGoods>().Where(x => x.Id == seaExport.GoodsId).First();
info.GoodName = seaExport.GoodsName;
info.HSCode = seaExport.HSCode;
sqlSugarScope.Updateable(info).RemoveDataCache($"{SqlSugarCacheConst.Goods}{user.TenantId}").IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return info.Id;
}
}
//public async Task<DataResult<CodeGoods>> SaveCheckCodeGood(string goodName,string code) //public async Task<DataResult<CodeGoods>> SaveCheckCodeGood(string goodName,string code)
//{ //{
// DateTime? stlDate; // DateTime? stlDate;

Loading…
Cancel
Save