订单编号根据揽货人编号生成

usertest
cjy 3 months ago
parent c766404a6f
commit 0c3fd95f86

@ -213,7 +213,7 @@ public partial class SeaExportService : ISeaExportService
// return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); // return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist));
//} //}
// //
var sequence = await commonService.GetSequenceNextAsync<SeaExport>(tenantDb, user); var sequence = await commonService.GetSequenceNextAsync<SeaExport>(tenantDb, user,req.SaleId);
if (!sequence.Succeeded) if (!sequence.Succeeded)
{ {
return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist)); return await Task.FromResult(DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist));
@ -690,7 +690,7 @@ public partial class SeaExportService : ISeaExportService
} }
//获取表单复制模板 //获取表单复制模板
var template = tenantDb.Queryable<CodeFormCopy>().Where(x => x.PermissionId == 1772509201441099776).First(); var template = tenantDb.Queryable<CodeFormCopy>().Where(x => x.PermissionId == 1772509201441099776).First();
var sequence = commonService.GetSequenceNextAsync<SeaExport>(tenantDb, user).GetAwaiter().GetResult(); var sequence = commonService.GetSequenceNextAsync<SeaExport>(tenantDb, user, info.SaleId).GetAwaiter().GetResult();
if (!sequence.Succeeded) if (!sequence.Succeeded)
{ {
return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist);

@ -209,7 +209,7 @@ public interface ICommonService
/// 获取最新业务单据编码 /// 获取最新业务单据编码
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public Task<DataResult<string>> GetSequenceNextAsync<T>(SqlSugarScopeProvider tenantDb, IUser user); public Task<DataResult<string>> GetSequenceNextAsync<T>(SqlSugarScopeProvider tenantDb, IUser user, long saleId = 0);
/// <summary> /// <summary>
/// 获取字典明细 /// 获取字典明细

@ -2050,7 +2050,7 @@ public class CommonService : ICommonService
/// 获取最新业务单据编码 /// 获取最新业务单据编码
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public async Task<DataResult<string>> GetSequenceNextAsync<T>(SqlSugarScopeProvider tenantDb, IUser user) public async Task<DataResult<string>> GetSequenceNextAsync<T>(SqlSugarScopeProvider tenantDb, IUser user,long saleId = 0)
{ {
//生成编号 //生成编号
string sequenceNewNo = ""; string sequenceNewNo = "";
@ -2084,10 +2084,14 @@ public class CommonService : ICommonService
case "variable": //变量方式 TODO case "variable": //变量方式 TODO
if (item.RuleValue == "UserNumber") if (item.RuleValue == "UserNumber")
{ {
var userInfo = await db.Queryable<SysUser>().FirstAsync(x => x.Id == long.Parse(user.UserId)); if (saleId == 0)
{
return await Task.FromResult(DataResult<string>.Failed("请维护订单揽货人信息!"));
}
var userInfo = await db.Queryable<SysUser>().FirstAsync(x => x.Id == saleId);
if (userInfo.UserNumber.IsNull()) if (userInfo.UserNumber.IsNull())
{ {
return await Task.FromResult(DataResult<string>.Failed("该用户编码未维护!")); return await Task.FromResult(DataResult<string>.Failed("该揽货人用户编码未维护!"));
} }
sequenceNewNo += userInfo.UserNumber; sequenceNewNo += userInfo.UserNumber;
} }

Loading…
Cancel
Save