调整出库申请,终止点位代码逻辑
This commit is contained in:
@@ -158,5 +158,16 @@ public partial class WmsOutstockH : BaseEntity<string>
|
|||||||
/// 修改时间
|
/// 修改时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime modify_time { get; set; } = DateTime.Now;
|
public DateTime modify_time { get; set; } = DateTime.Now;
|
||||||
|
/// <summary>
|
||||||
|
/// 工位Id
|
||||||
|
/// </summary>
|
||||||
|
public string station_id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工位编码
|
||||||
|
/// </summary>
|
||||||
|
public string station_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 载具Id
|
||||||
|
/// </summary>
|
||||||
|
public string carry_id { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Aop.Api.Domain;
|
using Aop.Api.Domain;
|
||||||
@@ -10,12 +11,14 @@ using JNPF.Common.Dtos.VisualDev;
|
|||||||
using JNPF.Common.Extension;
|
using JNPF.Common.Extension;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.Permission;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using JNPF.VisualDev.Entitys;
|
using JNPF.VisualDev.Entitys;
|
||||||
using JNPF.VisualDev.Interfaces;
|
using JNPF.VisualDev.Interfaces;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using SqlSugar.DbConvert;
|
using SqlSugar.DbConvert;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
@@ -101,10 +104,15 @@ namespace Tnb.WarehouseMgr
|
|||||||
code_batch = os.code_batch,
|
code_batch = os.code_batch,
|
||||||
};
|
};
|
||||||
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput);
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
Expression<Func<WmsCarryH, WmsCarryCode, bool>> whereExp = input.data.ContainsKey(nameof(WmsOutstockH.carry_id))
|
||||||
.Where((a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id))
|
? (a, b) => a.id == input.data[nameof(WmsOutstockH.carry_id)].ToString()
|
||||||
.Select<WmsCarryCode>()
|
: (a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id);
|
||||||
.ToListAsync();
|
|
||||||
|
List<WmsCarryCode>? carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||||
|
.Where(whereExp)
|
||||||
|
.Select<WmsCarryCode>()
|
||||||
|
.ToListAsync(); ;
|
||||||
|
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
{
|
{
|
||||||
var codeQty = carryCodesPart.Sum(x => x.codeqty);
|
var codeQty = carryCodesPart.Sum(x => x.codeqty);
|
||||||
@@ -199,6 +207,37 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||||
}
|
}
|
||||||
|
else if (input.data.ContainsKey(nameof(WmsOutstockH.station_id)))
|
||||||
|
{
|
||||||
|
//多个投料库位
|
||||||
|
/*
|
||||||
|
* 潍柴
|
||||||
|
* 1、那个库位状态是空的出那个
|
||||||
|
* 1.1、没有空位直接抛异常
|
||||||
|
*
|
||||||
|
* 天益
|
||||||
|
* 2、不管库位是否为空, 获取到所有库位 A B
|
||||||
|
* 2.1 根据这些库位去查任务执行 目的库位是这些库位的未完成任务数。 A 10 B 9
|
||||||
|
* 2.2 哪个最少给哪个
|
||||||
|
*/
|
||||||
|
var org = await _db.Queryable<OrganizeEntity>().FirstAsync(it => it.Id == input.data[nameof(WmsOutstockH.station_id)].ToString());
|
||||||
|
if (!org?.FeedingLocationId.IsNullOrWhiteSpace() ?? false)
|
||||||
|
{
|
||||||
|
var fLocIds = JArray.Parse(org.FeedingLocationId).Values<string>();
|
||||||
|
var minTaskNumLoc = await _db.Queryable<WmsPretaskH>().Where(it => it.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && fLocIds.Contains(it.endlocation_id))
|
||||||
|
.GroupBy(it => it.endlocation_id)
|
||||||
|
.Select(it => new
|
||||||
|
{
|
||||||
|
it.endlocation_id,
|
||||||
|
count = SqlFunc.AggregateCount(it.endlocation_id)
|
||||||
|
})
|
||||||
|
.MergeTable()
|
||||||
|
.OrderBy(it => it.count)
|
||||||
|
.FirstAsync();
|
||||||
|
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == minTaskNumLoc.endlocation_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (input.data.ContainsKey("tablefield115"))
|
if (input.data.ContainsKey("tablefield115"))
|
||||||
{
|
{
|
||||||
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
jArr = JArray.Parse(input.data["tablefield115"].ToString()!);
|
||||||
|
|
||||||
}
|
}
|
||||||
//入库取终点 //出库起点
|
//入库取终点 //出库起点
|
||||||
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
|
var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 };
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace JNPF.Systems.Entitys.Permission;
|
|||||||
/// 日 期:2017.09.20.
|
/// 日 期:2017.09.20.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("BASE_ORGANIZE")]
|
[SugarTable("BASE_ORGANIZE")]
|
||||||
public class OrganizeEntity : CLDEntityBase
|
public partial class OrganizeEntity : CLDEntityBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 机构上级.
|
/// 机构上级.
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace JNPF.Systems.Entitys.Permission;
|
||||||
|
|
||||||
|
public partial class OrganizeEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "F_FEEDING_LOCATIONID")]
|
||||||
|
public string FeedingLocationId { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user