货物状态更新时保存编码

dev
zhangxiaofeng 2 months ago
parent f4eaf9b3ce
commit 6c118d52a1

@ -183,12 +183,13 @@ namespace DS.WMS.Core.Op.Method
{
return DataResult<CustomerStlRes>.Failed("开船日期格式不正确!");
}
var accDate = tenantDb.Queryable<InfoClientAccountDate>().First(x=>x.ClientId == req.CustomerId && etd >= x.BeginDate && etd <= x.EndDate);
var accDate = tenantDb.Queryable<InfoClientAccountDate>().First(x => x.ClientId == req.CustomerId && etd >= x.BeginDate && etd <= x.EndDate);
if (accDate.IsNull())
{
return DataResult<CustomerStlRes>.Success(new CustomerStlRes() {
StlName ="票结",
return DataResult<CustomerStlRes>.Success(new CustomerStlRes()
{
StlName = "票结",
StlDate = req.ETD,
AccountDate = Convert.ToDateTime(req.ETD).ToString("yyyy-MM")
});
@ -281,7 +282,8 @@ namespace DS.WMS.Core.Op.Method
}
stlDate = DateTime.Parse(tmpYear.ToString() + "-" + tmpMonth.ToString() + "-" + tmpDay.ToString());
}
else {
else
{
tmpDay = (int)accDate.AccountMonth;
if ((int)accDate.AccountMonth > 28)
@ -306,7 +308,7 @@ namespace DS.WMS.Core.Op.Method
}
else if (accDate.AccountType == "季结")
{
stlDate = etd.AddDays((int)accDate.AccountMonth*90);
stlDate = etd.AddDays((int)accDate.AccountMonth * 90);
return DataResult<CustomerStlRes>.Success(new CustomerStlRes()
{
StlName = accDate.AccountType,
@ -381,14 +383,14 @@ namespace DS.WMS.Core.Op.Method
/// <param name="tenantDb"></param>
/// <param name="customerId"></param>
/// <returns></returns>
public CodeThirdParty GetCodeThirdParty(string type,string userId, SqlSugarScopeProvider tenantDb,long customerId =0)
public CodeThirdParty GetCodeThirdParty(string type, string userId, SqlSugarScopeProvider tenantDb, long customerId = 0)
{
//var account = new CodeThirdParty();
if (userId.IsNull())
{
return tenantDb.Queryable<CodeThirdParty>().First(x => x.AccountType == type) ;
return tenantDb.Queryable<CodeThirdParty>().First(x => x.AccountType == type);
}
var uId = long.Parse(userId);
if (customerId == 0)
@ -408,7 +410,7 @@ namespace DS.WMS.Core.Op.Method
{
return tenantDb.Queryable<CodeThirdParty>().Where(x => x.AccountType == type && x.CreateBy == uId && x.CustomerId == customerId).First();
}
else if(tenantDb.Queryable<CodeThirdParty>().Where(x => x.AccountType == type && x.CreateBy == uId).Any())
else if (tenantDb.Queryable<CodeThirdParty>().Where(x => x.AccountType == type && x.CreateBy == uId).Any())
{
return tenantDb.Queryable<CodeThirdParty>().First(x => x.AccountType == type && x.CreateBy == uId);
}
@ -482,7 +484,7 @@ namespace DS.WMS.Core.Op.Method
}
var code = yard.EDICode.IsNull() ? yard.CodeName : yard.EDICode;
var map= tenantDb.Queryable<MappingYard>().Where(v => v.Code == code).Select<EDIMapperInfo>().First();
var map = tenantDb.Queryable<MappingYard>().Where(v => v.Code == code).Select<EDIMapperInfo>().First();
if (map.IsNull())
{
@ -959,7 +961,7 @@ namespace DS.WMS.Core.Op.Method
/// </summary>
/// <param name="bookingId"></param>
/// <returns></returns>
public async Task SetBookingOrderGoodsStatus(long bookingId,SqlSugarScopeProvider tenantDb)
public async Task SetBookingOrderGoodsStatus(long bookingId, SqlSugarScopeProvider tenantDb)
{
//var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var order = tenantDb.Queryable<SeaExport>().Filter(null, true).First(x => x.Id == bookingId);
@ -984,15 +986,20 @@ namespace DS.WMS.Core.Op.Method
if (list != null)
{
//回写主单状态
var StatusName = list.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.OrderNo).Select(x => x.StatusName).FirstOrDefault();
if (StatusName == null)
var status = list.Where(x => x.FinishTime.HasValue).OrderByDescending(x => x.OrderNo).Select(x => new { x.SystemCode, x.StatusName }).FirstOrDefault();
if (status == null)
{
status = new
{
StatusName = "";
SystemCode = "",
StatusName = ""
};
}
var oldOrder = order.Adapt<SeaExport>();
order.BusinessStatusName = StatusName;
order.BusinessStatusName = status.StatusName;
order.BusinessStatus = status.SystemCode;
//order.Note = "更新主单货物状态";
await tenantDb.Updateable(order).EnableDiffLogEvent().ExecuteCommandAsync();
await tenantDb.Updateable(order).UpdateColumns(x => new { x.BusinessStatusName, x.BusinessStatus }).EnableDiffLogEvent().ExecuteCommandAsync();
// 记录日志
await SaveSeaExportLogAsync(new SeaExportSaveLog()
{
@ -2061,7 +2068,8 @@ namespace DS.WMS.Core.Op.Method
var order = tenantDb.Queryable<SeaExport>().Where(x => x.Id == req.Id).First();
if (order.IsNull()) {
if (order.IsNull())
{
return await Task.FromResult(DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist));
}

Loading…
Cancel
Save