Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -14,5 +14,22 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// 生产任务编号
|
/// 生产任务编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string mo_task_code { get; set; }
|
public string mo_task_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 开始时间
|
||||||
|
/// </summary>
|
||||||
|
public long[] estimated_start_date { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 结束时间
|
||||||
|
/// </summary>
|
||||||
|
public long[] estimated_end_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产线
|
||||||
|
/// </summary>
|
||||||
|
public string workline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工序
|
||||||
|
/// </summary>
|
||||||
|
public string process { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1070,8 +1070,7 @@ namespace Tnb.ProductionMgr
|
|||||||
record.masterial_name = material?.name;
|
record.masterial_name = material?.name;
|
||||||
record.plan_start_date = taskInfo.estimated_start_date;
|
record.plan_start_date = taskInfo.estimated_start_date;
|
||||||
record.plan_end_date = taskInfo.estimated_end_date;
|
record.plan_end_date = taskInfo.estimated_end_date;
|
||||||
// record.plan_qty = taskInfo.plan_qty;
|
record.plan_qty = taskInfo.plan_qty;
|
||||||
record.plan_qty = taskInfo.scheduled_qty;
|
|
||||||
record.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
|
record.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
|
||||||
record.mo_task_type = mo?.mo_type;
|
record.mo_task_type = mo?.mo_type;
|
||||||
record.status = taskInfo.mo_task_status;
|
record.status = taskInfo.mo_task_status;
|
||||||
|
|||||||
@@ -51,14 +51,35 @@ namespace Tnb.ProductionMgr
|
|||||||
if (input == null) throw new ArgumentNullException("input");
|
if (input == null) throw new ArgumentNullException("input");
|
||||||
List<PackReportTreeOutput> trees = new();
|
List<PackReportTreeOutput> trees = new();
|
||||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||||
|
var list = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToListAsync();
|
||||||
if (_dicWorkLine.Count < 1)
|
if (_dicWorkLine.Count < 1)
|
||||||
{
|
{
|
||||||
var list = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToListAsync();
|
|
||||||
_dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create<string, string>(x.EnCode, x.FullName));
|
_dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create<string, string>(x.EnCode, x.FullName));
|
||||||
}
|
}
|
||||||
|
bool start = false;
|
||||||
|
bool end=false;
|
||||||
|
DateTime[] startTimes = new DateTime[2];
|
||||||
|
DateTime[] endTimes = new DateTime[2];
|
||||||
|
if (input.estimated_start_date != null && input.estimated_start_date.Count() == 2)
|
||||||
|
{
|
||||||
|
start=true;
|
||||||
|
startTimes[0] = GetDateTimeMilliseconds(input.estimated_start_date![0]);
|
||||||
|
startTimes[1] = GetDateTimeMilliseconds(input.estimated_start_date![1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (input.estimated_end_date != null && input.estimated_end_date.Count() == 2)
|
||||||
|
{
|
||||||
|
end = true;
|
||||||
|
endTimes[0] = GetDateTimeMilliseconds(input.estimated_end_date![0]);
|
||||||
|
endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]);
|
||||||
|
|
||||||
|
}
|
||||||
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||||
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
|
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
|
||||||
|
.WhereIF(start, a => startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date)
|
||||||
|
.WhereIF(end, a => endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
|
||||||
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
||||||
.Select((a, b, c) => new PrdMoTask
|
.Select((a, b, c) => new PrdMoTask
|
||||||
{
|
{
|
||||||
@@ -101,6 +122,23 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var treeList = trees.ToTree();
|
var treeList = trees.ToTree();
|
||||||
|
if (!string.IsNullOrEmpty(input.process))
|
||||||
|
{
|
||||||
|
foreach (var item in treeList)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
if (item.process_id != null && item.process_id.Contains(input.process))
|
||||||
|
flag = true;
|
||||||
|
if (item.children != null)
|
||||||
|
{
|
||||||
|
List<PackReportTreeOutput> childs = (List<PackReportTreeOutput>)(Object)item.children;
|
||||||
|
if (childs.Where(p => p.process_id.Contains(input.process)).Any())
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (!flag)
|
||||||
|
treeList.Remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
SqlSugarPagedList<PackReportTreeOutput> pagedList = new()
|
SqlSugarPagedList<PackReportTreeOutput> pagedList = new()
|
||||||
{
|
{
|
||||||
list = treeList,
|
list = treeList,
|
||||||
@@ -113,7 +151,16 @@ namespace Tnb.ProductionMgr
|
|||||||
};
|
};
|
||||||
return PageResult<PackReportTreeOutput>.SqlSugarPageResult(pagedList);
|
return PageResult<PackReportTreeOutput>.SqlSugarPageResult(pagedList);
|
||||||
}
|
}
|
||||||
|
private static DateTime GetDateTimeMilliseconds(long timestamp)
|
||||||
|
{
|
||||||
|
long begtime = timestamp * 10000;
|
||||||
|
DateTime dt_1970 = new DateTime(1970, 1, 1, 8, 0, 0);
|
||||||
|
long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度
|
||||||
|
long time_tricks = tricks_1970 + begtime;//日志日期刻度
|
||||||
|
DateTime dt = new DateTime(time_tricks);//转化为DateTime
|
||||||
|
return dt;
|
||||||
|
|
||||||
|
}
|
||||||
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
||||||
{
|
{
|
||||||
var items = await _db.Queryable<PrdMoTask>()
|
var items = await _db.Queryable<PrdMoTask>()
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ namespace Tnb.ProductionMgr
|
|||||||
// reported_qty = a.reported_qty,
|
// reported_qty = a.reported_qty,
|
||||||
// prd_qty = a.prd_qty,
|
// prd_qty = a.prd_qty,
|
||||||
eqp_code = d.code,
|
eqp_code = d.code,
|
||||||
mbom_process_id = a.mbom_process_id,
|
|
||||||
}).FirstAsync();
|
}).FirstAsync();
|
||||||
|
|
||||||
return prdTask;
|
return prdTask;
|
||||||
|
|||||||
@@ -19,9 +19,5 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
|||||||
/// 载具ID
|
/// 载具ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string carryId { get; set; }
|
public string carryId { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// 服务模块
|
|
||||||
/// </summary>
|
|
||||||
public string serviceModule { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using JNPF.Common.Contracts;
|
using JNPF.Common.Contracts;
|
||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using SqlSugar.DbConvert;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr.Entities;
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
@@ -42,7 +43,9 @@ public partial class WmsCarryH : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具状态
|
/// 载具状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string carry_status { get; set; }
|
///
|
||||||
|
[SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))]
|
||||||
|
public int carry_status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 载具分类ID
|
/// 载具分类ID
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ public partial class WmsDistaskH
|
|||||||
/// 载具状态
|
/// 载具状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string carry_status { get; set; }
|
public int carry_status { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,4 @@ public partial class WmsFeedingrecordCode : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? modify_time { get; set; }
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 行号
|
|
||||||
/// </summary>
|
|
||||||
public int no { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -446,11 +446,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
for (int i = 0; i < multis.Count; i++)
|
for (int i = 0; i < multis.Count; i++)
|
||||||
{
|
{
|
||||||
var carryStatus = multis[i].carry_status;
|
var carryStatus = multis[i].carry_status;
|
||||||
if (multis[i].carry_status == "0")
|
if (multis[i].carry_status == (int)EnumCarryStatus.空闲)
|
||||||
{
|
{
|
||||||
carryStatus = "1";
|
carryStatus = (int)EnumCarryStatus.空闲;
|
||||||
}
|
}
|
||||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = carryStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
//更新业务主表的单据状态
|
//更新业务主表的单据状态
|
||||||
if (disTasks?.Count > 0)
|
if (disTasks?.Count > 0)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -69,9 +70,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
|
var subCarry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == subCarryId);
|
||||||
if (carry != null && subCarry != null)
|
if (carry != null && subCarry != null)
|
||||||
{
|
{
|
||||||
carry.carry_status = "1";
|
carry.carry_status = (int)EnumCarryStatus.占用;
|
||||||
var row = await _db.Updateable(carry).ExecuteCommandAsync();
|
var row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
subCarry.carry_status = "1";
|
subCarry.carry_status = (int)EnumCarryStatus.占用;
|
||||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
//更新载具明细表
|
//更新载具明细表
|
||||||
WmsCarryD wmsCarryD = new()
|
WmsCarryD wmsCarryD = new()
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
carryObj.status = 0;
|
carryObj.status = 0;
|
||||||
carryObj.carry_status = "0";
|
carryObj.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
carryObj.location_id = null;
|
carryObj.location_id = null;
|
||||||
carryObj.location_code = null;
|
carryObj.location_code = null;
|
||||||
carryObj.out_status = "0";
|
carryObj.out_status = "0";
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -91,9 +92,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsCarryUnbindCode.create_time = DateTime.Now;
|
wmsCarryUnbindCode.create_time = DateTime.Now;
|
||||||
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
|
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
carry.carry_status = "0";
|
carry.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
subCarry.carry_status = "0";
|
subCarry.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
isOk = (row > 0);
|
isOk = (row > 0);
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
|
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString());
|
||||||
{
|
{
|
||||||
//载具加锁,增加库位信息
|
//载具加锁,增加库位信息
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.占用,
|
||||||
is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync();
|
is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
||||||
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
||||||
&& a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0)
|
&& a.carry_status == (int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
WmsPointH sPoint = null;
|
WmsPointH sPoint = null;
|
||||||
|
|||||||
@@ -81,20 +81,36 @@ namespace Tnb.WarehouseMgr
|
|||||||
List<WmsCarryCode> carryCodes = new();
|
List<WmsCarryCode> carryCodes = new();
|
||||||
foreach (var os in outStockDList)
|
foreach (var os in outStockDList)
|
||||||
{
|
{
|
||||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id)
|
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)
|
||||||
.Where((a, b) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用)
|
.Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||||
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
||||||
.Select<WmsCarryCode>()
|
.Select<WmsCarryCode>()
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (carryCodesPart?.Count > 0)
|
if (carryCodesPart?.Count > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
carryCodes.AddRange(carryCodesPart);
|
carryCodes.AddRange(carryCodesPart);
|
||||||
var codeQty = carryCodes.Sum(x => x.codeqty);
|
var codeQty = carryCodes.Sum(x => x.codeqty);
|
||||||
if (codeQty < os.pr_qty)
|
if (codeQty < os.pr_qty)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
|
throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500);
|
||||||
}
|
}
|
||||||
var partCarryMats = carryCodesPart.Adapt<List<WmsCarryMat>>();
|
List<WmsCarryCode> curCarryCodes = new();
|
||||||
|
for (int i = 0; i < carryCodesPart.Count; i++)
|
||||||
|
{
|
||||||
|
if (os.pr_qty > carryCodesPart[i].codeqty)
|
||||||
|
{
|
||||||
|
os.pr_qty -= carryCodesPart[i].codeqty;
|
||||||
|
curCarryCodes.Add(carryCodesPart[i]);
|
||||||
|
}
|
||||||
|
else if (os.pr_qty <= carryCodesPart[i].codeqty)
|
||||||
|
{
|
||||||
|
carryCodesPart[i].codeqty = os.pr_qty;
|
||||||
|
curCarryCodes.Add(carryCodesPart[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var partCarryMats = curCarryCodes.Adapt<List<WmsCarryMat>>();
|
||||||
for (int i = 0; i < partCarryMats.Count; i++)
|
for (int i = 0; i < partCarryMats.Count; i++)
|
||||||
{
|
{
|
||||||
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
|
partCarryMats[i].need_qty = carryCodesPart[i].codeqty;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -83,9 +84,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
create_time = DateTime.Now
|
create_time = DateTime.Now
|
||||||
};
|
};
|
||||||
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync();
|
||||||
carry.carry_status = "1";
|
carry.carry_status = (int)EnumCarryStatus.占用;
|
||||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
subCarry.carry_status = "1";
|
subCarry.carry_status = (int)EnumCarryStatus.占用;
|
||||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
var items = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == subCarryId).ToListAsync();
|
||||||
//更新载具绑定条码表
|
//更新载具绑定条码表
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities;
|
|||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -90,9 +91,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
wmsCarryUnbindCode.create_time = DateTime.Now;
|
wmsCarryUnbindCode.create_time = DateTime.Now;
|
||||||
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
|
row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
carry.carry_status = "0";
|
carry.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
row = await _db.Updateable(carry).ExecuteCommandAsync();
|
||||||
subCarry.carry_status = "0";
|
subCarry.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
row = await _db.Updateable(subCarry).ExecuteCommandAsync();
|
||||||
isOk = (row > 0);
|
isOk = (row > 0);
|
||||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//载具加锁,增加库位信息
|
//载具加锁,增加库位信息
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
{
|
{
|
||||||
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
carry_status = (int)EnumCarryStatus.占用,
|
||||||
is_lock = 1,
|
is_lock = 1,
|
||||||
location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(),
|
location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(),
|
||||||
location_code = location.location_code
|
location_code = location.location_code
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
var setQty = await _db.Queryable<WmsEmptyOutstockH>().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString());
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
var carrys = await _db.Queryable<WmsCarryH>().LeftJoin<BasLocation>((a, b) => a.location_id == b.id)
|
||||||
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
.Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString()
|
||||||
&& a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0)
|
&& a.carry_status ==(int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
WmsPointH sPoint = null;
|
WmsPointH sPoint = null;
|
||||||
|
|||||||
@@ -61,10 +61,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </param>
|
/// </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
|
|
||||||
private async Task<dynamic> WmsPDAFeedingRecord(VisualDevModelDataCrInput input)
|
private async Task<dynamic> WmsPDAFeedingRecord(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -79,7 +78,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var feedBox = await _db.Queryable<WmsFeedbox>().SingleAsync(it => it.feedbox_code == feedBoxCode);
|
var feedBox = await _db.Queryable<WmsFeedbox>().SingleAsync(it => it.feedbox_code == feedBoxCode);
|
||||||
var carryMaterial = await _db.Queryable<WmsCarryMat>().FirstAsync(it => it.carry_id == carryId);
|
var carryMaterial = await _db.Queryable<WmsCarryMat>().FirstAsync(it => it.carry_id == carryId);
|
||||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||||
if (carry != null && feedBox != null)
|
if (carryMaterial != null && feedBox != null && carry != null)
|
||||||
{
|
{
|
||||||
//更新投料箱
|
//更新投料箱
|
||||||
feedBox.material_id = carryMaterial.material_id;
|
feedBox.material_id = carryMaterial.material_id;
|
||||||
@@ -97,27 +96,6 @@ namespace Tnb.WarehouseMgr
|
|||||||
it.modify_id,
|
it.modify_id,
|
||||||
it.modify_time
|
it.modify_time
|
||||||
}).ExecuteCommandAsync();
|
}).ExecuteCommandAsync();
|
||||||
//更新投料记录条码表
|
|
||||||
if (carryCodes != null)
|
|
||||||
{
|
|
||||||
foreach (var carryCode in carryCodes)
|
|
||||||
{
|
|
||||||
WmsFeedingrecordCode wmsFeedingrecordCode = new();
|
|
||||||
wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId();
|
|
||||||
wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId;
|
|
||||||
wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!;
|
|
||||||
wmsFeedingrecordCode.material_id = carryCode.material_id;
|
|
||||||
wmsFeedingrecordCode.material_code = carryCode.material_code;
|
|
||||||
wmsFeedingrecordCode.barcode = carryCode.barcode;
|
|
||||||
wmsFeedingrecordCode.code_batch = carryCode.code_batch;
|
|
||||||
wmsFeedingrecordCode.codeqty = carryCode.codeqty;
|
|
||||||
wmsFeedingrecordCode.unit_id = carryCode.unit_id;
|
|
||||||
wmsFeedingrecordCode.unit_code = carryCode.unit_code;
|
|
||||||
wmsFeedingrecordCode.create_id = _userManager.UserId;
|
|
||||||
wmsFeedingrecordCode.create_time = DateTime.Now;
|
|
||||||
row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更新载具
|
//更新载具
|
||||||
row = await UpdateNullCarry(carry);
|
row = await UpdateNullCarry(carry);
|
||||||
isOk = (row > 0);
|
isOk = (row > 0);
|
||||||
@@ -125,7 +103,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (carry == null)
|
if (carryMaterial == null)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("没有可用的载具", 500);
|
throw new AppFriendlyException("没有可用的载具", 500);
|
||||||
}
|
}
|
||||||
@@ -139,7 +117,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error("载具更换失败", ex);
|
Log.Error("投料失败", ex);
|
||||||
await _db.Ado.RollbackTranAsync();
|
await _db.Ado.RollbackTranAsync();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@@ -152,7 +130,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
carryObj.status = 0;
|
carryObj.status = 0;
|
||||||
carryObj.carry_status = "0";
|
carryObj.carry_status = (int)EnumCarryStatus.空闲;
|
||||||
carryObj.location_id = null;
|
carryObj.location_id = null;
|
||||||
carryObj.location_code = null;
|
carryObj.location_code = null;
|
||||||
carryObj.out_status = "0";
|
carryObj.out_status = "0";
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||||
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
|
await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync();
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||||
it => new BasLocation { is_lock = 1, is_use = "1" });
|
it => new BasLocation { is_lock = 1, is_use = "1" });
|
||||||
if (instockCOdes?.Count > 0)
|
if (instockCOdes?.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString();
|
var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString();
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||||
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = ((int)EnumCarryStatus.寄存).ToString(), bale_num = baleNum },
|
it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = (int)EnumCarryStatus.寄存, bale_num = baleNum },
|
||||||
it => new BasLocation { is_lock = 1 });
|
it => new BasLocation { is_lock = 1 });
|
||||||
//((int)EnumCarryStatus.寄存).ToString()
|
//((int)EnumCarryStatus.寄存).ToString()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//载具加锁,增加库位信息
|
//载具加锁,增加库位信息
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
{
|
{
|
||||||
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
carry_status = (int)EnumCarryStatus.占用,
|
||||||
is_lock = 1,
|
is_lock = 1,
|
||||||
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
||||||
location_code = location.location_code
|
location_code = location.location_code
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||||
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 });
|
await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = ((int)EnumCarryStatus.齐套分拣).ToString() });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -185,5 +185,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override Task ModifyAsync(WareHouseUpInput input)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ using SqlSugar;
|
|||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
@@ -57,6 +58,10 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
_dicBizType = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_BIZTYPE_ID);
|
_dicBizType = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_BIZTYPE_ID);
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carryId);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == input.carryId);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
@@ -80,6 +85,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
loc.is_use = "0";
|
loc.is_use = "0";
|
||||||
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
//载具加锁,增加库位信息
|
//载具加锁,增加库位信息
|
||||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH
|
||||||
{
|
{
|
||||||
carry_status = ((int)EnumCarryStatus.占用).ToString(),
|
carry_status = (int)EnumCarryStatus.占用,
|
||||||
is_lock = 1,
|
is_lock = 1,
|
||||||
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(),
|
||||||
location_code = location.location_code
|
location_code = location.location_code
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
||||||
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
||||||
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds, LocationIds = new List<string> { carry.location_id, ko.location_id } };
|
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds, LocationIds = new List<string> { carry.location_id, ko.location_id } };
|
||||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套 }, it => new BasLocation { is_lock = 1 });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user