1
This commit is contained in:
@@ -12,6 +12,7 @@ using JNPF.Common.Enums;
|
|||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
@@ -46,7 +47,8 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
protected async Task DoUpdate(WareHouseUpInput input)
|
protected async Task DoUpdate(WareHouseUpInput input)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
warehouse_name = c.whname,
|
warehouse_name = c.whname,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return items;
|
return items ?? Enumerable.Empty<dynamic>();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 库房业务,入库、出库申请新增修改功能
|
/// 库房业务,入库、出库申请新增修改功能
|
||||||
@@ -139,27 +139,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<dynamic?> GetInOutStockCodesById([FromQuery] InOutStockDetailQuery input)
|
public async Task<dynamic?> GetInOutStockCodesById([FromQuery] InOutStockDetailQuery input)
|
||||||
{
|
{
|
||||||
async Task<dynamic?> _fetchInOutStockCodesById<TStockD, TOutput, TStockCode>(string billDId)
|
|
||||||
where TStockD : BaseEntity<string>, new()
|
|
||||||
where TOutput : IInOutStockDetail<TStockCode>, new()
|
|
||||||
where TStockCode : BaseEntity<string>, IInOutStockCode, new()
|
|
||||||
{
|
|
||||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
|
||||||
var data = await _db.Queryable<TStockD>()
|
|
||||||
.Where(a => a.id == billDId)
|
|
||||||
.Select(a => new TOutput
|
|
||||||
{
|
|
||||||
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
|
||||||
}, true)
|
|
||||||
.Mapper(it => it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
|
||||||
.ToListAsync();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic? result = input.inoutStockType switch
|
dynamic? result = input.inoutStockType switch
|
||||||
{
|
{
|
||||||
EnumInOutStockType.In => await _fetchInOutStockCodesById<WmsInstockD, InStockDetailOutput, WmsInstockCode>(input.bill_d_id),
|
EnumInOutStockType.In => await FetchInOutStockCodesById<WmsInstockD, InStockDetailOutput, WmsInstockCode>(input.bill_d_id),
|
||||||
EnumInOutStockType.Out => await _fetchInOutStockCodesById<WmsOutstockD, OutStockDetailOutput, WmsOutstockCode>(input.bill_d_id),
|
EnumInOutStockType.Out => await FetchInOutStockCodesById<WmsOutstockD, OutStockDetailOutput, WmsOutstockCode>(input.bill_d_id),
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(input.inoutStockType), $"Not expected EnumInOutStockType value: {input.inoutStockType}"),
|
_ => throw new ArgumentOutOfRangeException(nameof(input.inoutStockType), $"Not expected EnumInOutStockType value: {input.inoutStockType}"),
|
||||||
};
|
};
|
||||||
return result ?? Enumerable.Empty<dynamic>();
|
return result ?? Enumerable.Empty<dynamic>();
|
||||||
@@ -737,7 +720,30 @@ namespace Tnb.WarehouseMgr
|
|||||||
return isOk;
|
return isOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据明细Id获取出入库明细信息
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TStockD">出入库明细</typeparam>
|
||||||
|
/// <typeparam name="TOutput">明细输出类</typeparam>
|
||||||
|
/// <typeparam name="TStockCode">出入库条码</typeparam>
|
||||||
|
/// <param name="billDId">明细Id</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<dynamic?> FetchInOutStockCodesById<TStockD, TOutput, TStockCode>(string billDId)
|
||||||
|
where TStockD : BaseEntity<string>, new()
|
||||||
|
where TOutput : IInOutStockDetail<TStockCode>, new()
|
||||||
|
where TStockCode : BaseEntity<string>, IInOutStockCode, new()
|
||||||
|
{
|
||||||
|
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
||||||
|
var data = await _db.Queryable<TStockD>()
|
||||||
|
.Where(a => a.id == billDId)
|
||||||
|
.Select(a => new TOutput
|
||||||
|
{
|
||||||
|
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
||||||
|
}, true)
|
||||||
|
.Mapper(it => it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
||||||
|
.ToListAsync();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user