|
|
|
@ -18,6 +18,7 @@ using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.AspNetCore.Http.HttpResults;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NPOI.POIFS.Crypt.Dsig;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
@ -42,7 +43,95 @@ public class ClientCommonService : IClientCommonService
|
|
|
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 根据单位获取数量箱型信息
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据单位获取数量箱型信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<UnitSelectInfoRes> GetUnitSelectInfo(UnitSelectInfoReq req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
//var data = new ClientSelectInfoRes();
|
|
|
|
|
if (req.BusinessType == BusinessType.OceanShippingExport)
|
|
|
|
|
{
|
|
|
|
|
var info = tenantDb.Queryable<SeaExport>().First(x => x.Id == req.BusinessId);
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return DataResult<UnitSelectInfoRes>.Failed("业务信息不存在!");
|
|
|
|
|
}
|
|
|
|
|
var ctns = tenantDb.Queryable<OpCtn>().Where(x => x.BSNO == req.BusinessId.ToString()).ToList();
|
|
|
|
|
|
|
|
|
|
var dictvalue = db.Queryable<SysDictData>().InnerJoin<SysDictType>((a, b) => a.TypeId == b.Id)
|
|
|
|
|
.Where((a, b) => b.Code == "fee_unit").Select((a, b) => a.Value).ToList();
|
|
|
|
|
if (dictvalue.Where(x=>x ==req.Code).Any())
|
|
|
|
|
{
|
|
|
|
|
var data = GetSeaExportUnit(info, req.Code);
|
|
|
|
|
return DataResult<UnitSelectInfoRes>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var codeCtns = tenantDb.Queryable<CodeCtn>().Where(x => x.Status == StatusEnum.Enable).ToList();
|
|
|
|
|
|
|
|
|
|
if (codeCtns.Where(x => x.CtnName == req.Code).Any())
|
|
|
|
|
{
|
|
|
|
|
//var data = GetSeaExportCtnsUnit(ctns, codeCtns, req.Code);
|
|
|
|
|
var codeCtn = codeCtns.First(x => x.CtnName == req.Code);
|
|
|
|
|
var ctns1 = ctns.Where(x => x.Ctn == req.Code).ToList();
|
|
|
|
|
|
|
|
|
|
var data = new UnitSelectInfoRes();
|
|
|
|
|
data.Code = req.Code;
|
|
|
|
|
data.Quantity = ctns1.Sum(x => x.CtnNum);
|
|
|
|
|
data.TEU = (int)data.Quantity * (int)codeCtn.TEU;
|
|
|
|
|
data.CtnTotalNum = ctns.Sum(x => x.CtnNum);
|
|
|
|
|
|
|
|
|
|
return DataResult<UnitSelectInfoRes>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return DataResult<UnitSelectInfoRes>.Failed("没有维护该箱型的集装箱信息!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return DataResult<UnitSelectInfoRes>.Failed("非法业务类型");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private UnitSelectInfoRes GetSeaExportUnit(SeaExport seaExport, string code)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var data = new UnitSelectInfoRes();
|
|
|
|
|
data.Code = code;
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case "P"://单票
|
|
|
|
|
data.Quantity = 1;
|
|
|
|
|
break;
|
|
|
|
|
case "Z"://重量
|
|
|
|
|
data.Quantity = seaExport.KGS;
|
|
|
|
|
break;
|
|
|
|
|
case "C"://尺码
|
|
|
|
|
data.Quantity = seaExport.CBM;
|
|
|
|
|
break;
|
|
|
|
|
case "J"://件数
|
|
|
|
|
data.Quantity = seaExport.PKGS;
|
|
|
|
|
break;
|
|
|
|
|
case "JF"://计费吨
|
|
|
|
|
data.Quantity = seaExport.KGS/1000> seaExport.CBM? seaExport.KGS/1000: seaExport.CBM;
|
|
|
|
|
break;
|
|
|
|
|
//默认
|
|
|
|
|
default:
|
|
|
|
|
data.Quantity = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#region 根据类型获取往来单位下拉及业务信息列表
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据类型获取往来单位下拉及业务信息列表
|
|
|
|
|