原材料/成品调拨出库接口、采购收货添加是否赠品、单价、是否自制字段
This commit is contained in:
@@ -395,6 +395,18 @@ namespace Tnb.WarehouseMgr
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3, WmsWareHouseConst.Floor1GLSGWOutstockStation4, WmsWareHouseConst.Floor1GLSGWOutstockStation5 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否为原材料调拨出库库位
|
||||
/// </summary>
|
||||
/// <param name="location_id"></param>
|
||||
/// <returns></returns>
|
||||
public string[] GetFloor1YCLDBOutstockLocation()
|
||||
{
|
||||
return new string[5] { WmsWareHouseConst.Floor1GLSGWOutstockStation1 , WmsWareHouseConst.Floor1GLSGWOutstockStation2
|
||||
, WmsWareHouseConst.Floor1GLSGWOutstockStation3, WmsWareHouseConst.Floor1GLSGWOutstockStation4, WmsWareHouseConst.Floor1GLSGWOutstockStation5 };
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否为外协三工位库位
|
||||
/// </summary>
|
||||
@@ -432,7 +444,6 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
SqlSugarClient cyDb = _db.CopyNew();
|
||||
|
||||
|
||||
List<Tuple<string, WmsCarryH, WmsCarryCode, BasLocation>> items = cyDb.Queryable<WmsCarryH>().LeftJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
||||
.LeftJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
.Where(whereExpr)
|
||||
@@ -3655,8 +3666,8 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
Logger.LogInformation($"【CommonCreatePretask】 {ex.Message}");
|
||||
Logger.LogInformation($"【CommonCreatePretask】 {ex.StackTrace}");
|
||||
if (!db.Ado.Transaction.IsNull())
|
||||
await db.Ado.CommitTranAsync();
|
||||
//if (!db.Ado.Transaction.IsNull())
|
||||
// await db.Ado.CommitTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
finally
|
||||
@@ -3669,6 +3680,105 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 可下发载具查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[HttpPost, NonUnify, AllowAnonymous]
|
||||
public async Task<Tnb.WarehouseMgr.Entities.Dto.Outputs.Result> CarryMaterialInventory(CarryMaterialInventoryInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.warehouse_code))
|
||||
{
|
||||
throw new AppFriendlyException("出库仓库不可为空", 500);
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(input.material_id))
|
||||
{
|
||||
throw new AppFriendlyException("物料id不可为空", 500);
|
||||
}
|
||||
if (string.IsNullOrEmpty(input.code_batch))
|
||||
{
|
||||
throw new AppFriendlyException("批号不可为空", 500);
|
||||
}
|
||||
|
||||
BasWarehouse basWarehouse = await _db.Queryable<BasWarehouse>().Where(r => r.whcode == input.warehouse_code).FirstAsync();
|
||||
|
||||
switch (basWarehouse.id)
|
||||
{
|
||||
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||
{
|
||||
OutStockStrategyQuery outStockStrategyInput = new()
|
||||
{
|
||||
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
|
||||
material_id = input.material_id,
|
||||
code_batch = input.code_batch,
|
||||
Size = 100,
|
||||
Region_id = WmsWareHouseConst.REGION_Purchase_ID,
|
||||
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK,
|
||||
AvoidBusyPassage = true
|
||||
};
|
||||
|
||||
List<WmsCarryH> items = await OutStockStrategy(outStockStrategyInput);
|
||||
|
||||
var wmsCarryCodes = await _db.Queryable<WmsCarryCode>()
|
||||
.InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id)
|
||||
.InnerJoin<BasMaterial>((a, b, c) => a.material_id == c.id)
|
||||
.Where((a, b, c) => items.Select(r => r.id).Contains(a.carry_id))
|
||||
.Select((a, b, c) => new
|
||||
{
|
||||
carry_id = a.carry_id,
|
||||
carry_code = b.carry_code,
|
||||
material_id = c.id,
|
||||
material_code = c.code,
|
||||
material_name = c.name,
|
||||
material_specification = c.material_specification,
|
||||
barcode = a.barcode,
|
||||
code_batch = a.code_batch,
|
||||
qty = a.codeqty
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var wmsCarryCodesSum = wmsCarryCodes.GroupBy(r => new { r.carry_id, r.material_id, r.code_batch }).Select(g =>
|
||||
{
|
||||
var list = g.ToList();
|
||||
|
||||
var newg = new
|
||||
{
|
||||
carry_id = list[0].carry_id,
|
||||
carry_code = list[0].carry_code,
|
||||
material_id = list[0].material_id,
|
||||
material_code = list[0].material_code,
|
||||
material_name = list[0].material_name,
|
||||
material_specification = list[0].material_specification,
|
||||
barcode = list[0].barcode,
|
||||
code_batch = list[0].code_batch,
|
||||
qty = g.Sum(r => r.qty)
|
||||
};
|
||||
|
||||
return newg;
|
||||
});
|
||||
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, "成功", wmsCarryCodesSum);
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new AppFriendlyException("此仓库业务未完善", 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user