dev
cjy 2 months ago
parent 1fa5240f2f
commit 204fe3535f

@ -872,7 +872,9 @@ public partial class SeaExportService : ISeaExportService
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
}
#region 复制
/// <summary>
/// 业务单据单票复制
@ -950,6 +952,82 @@ public partial class SeaExportService : ISeaExportService
}
/// <summary>
/// 业务单据单票复制
/// </summary>
/// <param name="id">业务Id</param>
/// <returns></returns>
public DataResult GetSeaExportCopyInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var info = tenantDb.Queryable<SeaExport>().Where(x => x.Id == long.Parse(id)).First();
if (info.IsNullOrEmpty())
{
return DataResult.Failed("海运出口信息不存在!", MultiLanguageConst.SeaExportNotExist);
}
//获取表单复制模板
var template = tenantDb.Queryable<CodeFormCopy>().Where(x => x.PermissionId == 1772509201441099776).First();
//var sequence = commonService.GetSequenceNextAsync<SeaExport>(tenantDb, user, info.SaleId).GetAwaiter().GetResult();
//if (!sequence.Succeeded)
//{
// return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist);
//}
var data = new SeaExport();
if (template.IsNullOrEmpty())
{
data = info.Adapt(data);
data.Id = 0;
data.ParentId = 0;
//data.IsBusinessLocking = false;
//data.IsFeeLocking = false;
//data.CustomerNo = sequence.Data;
data.BusinessStatusName = "";
data.CustomerNo = "";
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
#region 初始化费用状态表
var feeStatus = BusinessFeeStatus.Init(entity.Id);
tenantDb.Insertable(feeStatus).ExecuteCommand();
#endregion
return DataResult.Successed("复制成功!", entity.Id, MultiLanguageConst.DataCopySuccess);
}
else
{
data = info.Adapt(data);
data.Id = 0;
data.ParentId = 0;
data.CustomerNo = "";
data.BusinessStatusName = "";
//data.IsBusinessLocking = false;
//data.IsFeeLocking = false;
//data.CustomerNo = sequence.Data;
var list0 = template.CopyFields.Split(",");
var list1 = new List<string>();
foreach (var item in list0)
{
list1.Add(item.ToUpperCamelCase());
}
list1.Add("IsBusinessLocking");
list1.Add("IsFeeLocking");
//list1.Add("CustomerNo");
var insertColumns = list1.ToArray();
//insertColumns.AddRange(["Id", "ParentId", "IsBusinessLocking", "IsFeeLocking", "CustomerNo"]);
var entity = tenantDb.Insertable(data).InsertColumns(insertColumns).ExecuteReturnEntity();
#region 初始化费用状态表
var feeStatus = BusinessFeeStatus.Init(entity.Id);
tenantDb.Insertable(feeStatus).ExecuteCommand();
#endregion
return DataResult.Successed("复制成功!", entity.Id, MultiLanguageConst.DataCopySuccess);
}
}
#endregion
#region 删除

Loading…
Cancel
Save