Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -253,5 +253,15 @@ public partial class BasMaterial : BaseEntity<string>
|
||||
/// 是否创建子工单
|
||||
/// </summary>
|
||||
public string? is_create_sub_work_order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public int? quality_guarantee_period { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DI编码
|
||||
/// </summary>
|
||||
public string? di { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -197,5 +197,10 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
/// 物料清单id
|
||||
/// </summary>
|
||||
public string? ebom_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批号
|
||||
/// </summary>
|
||||
public string? batch { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ public partial class PrdOutPackMarkLabel : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 是否喷码 0 否 1 是
|
||||
/// </summary>
|
||||
public int is_mark { get; set; }
|
||||
public int? is_mark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否贴标 0 否 1 是
|
||||
/// </summary>
|
||||
public int is_label { get; set; }
|
||||
public int? is_label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务单号
|
||||
|
||||
@@ -2753,18 +2753,35 @@ namespace Tnb.ProductionMgr
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark==null).AnyAsync())
|
||||
{
|
||||
is_mark = 0,
|
||||
is_label = 0,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
};
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_mark == 0)
|
||||
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 &&
|
||||
x.is_mark == null)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
{
|
||||
is_mark = 0,
|
||||
is_label = null,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
};
|
||||
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
|
||||
|
||||
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
|
||||
return code;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2781,19 +2798,35 @@ namespace Tnb.ProductionMgr
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync())
|
||||
{
|
||||
is_mark = 0,
|
||||
is_label = 0,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
station_id = input.station_id,
|
||||
};
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_label == 0)
|
||||
.Where(x => x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null &&
|
||||
x.is_mark == 0)
|
||||
.ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
PrdOutPackMarkLabel prdOutPackMarkLabel = new PrdOutPackMarkLabel()
|
||||
{
|
||||
is_mark = null,
|
||||
is_label = 0,
|
||||
mo_task_code = prdMoTask.mo_task_code,
|
||||
material_code = prdMoTask.material_code,
|
||||
create_time = DateTime.Now,
|
||||
};
|
||||
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return prdMoTask.mo_task_code + "/" + prdMoTask.material_code;
|
||||
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -498,11 +498,12 @@ namespace Tnb.ProductionMgr
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> OutPackMarkCheck(MarkingLabelInput input)
|
||||
{
|
||||
string[] arr = input.mark_code.Split("/");
|
||||
string[] arr = input.mark_code.Split("(10)");
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
string mo_task_code = arr[0];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == mo_task_code).FirstAsync();
|
||||
string batch = arr[1];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.batch == batch).FirstAsync();
|
||||
string mo_task_code = prdMoTask.mo_task_code;
|
||||
if (prdMoTask == null) throw Oops.Bah("未找到对应任务单");
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().Where(x => x.id == prdMoTask.material_id).FirstAsync();
|
||||
DictionaryDataEntity unit = await _db.Queryable<DictionaryTypeEntity>()
|
||||
@@ -567,11 +568,12 @@ namespace Tnb.ProductionMgr
|
||||
/// <returns></returns>
|
||||
public async Task<dynamic> OutPackLabelCheck(MarkingLabelInput input)
|
||||
{
|
||||
string[] arr = input.mark_code.Split("/");
|
||||
string[] arr = input.label_code.Split("(10)");
|
||||
if (arr.Length > 1)
|
||||
{
|
||||
string mo_task_code = arr[0];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.mo_task_code == mo_task_code).FirstAsync();
|
||||
string batch = arr[1];
|
||||
PrdMoTask prdMoTask = await _db.Queryable<PrdMoTask>().Where(x => x.batch == batch).FirstAsync();
|
||||
string mo_task_code = prdMoTask.mo_task_code;
|
||||
if (prdMoTask == null) throw Oops.Bah("未找到对应任务单");
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().Where(x => x.id == prdMoTask.material_id).FirstAsync();
|
||||
DictionaryDataEntity unit = await _db.Queryable<DictionaryTypeEntity>()
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ModuleConsts
|
||||
public const string MODULE_WMSPOINT_ID = "26099196480805";
|
||||
|
||||
/// <summary>
|
||||
/// 模块标识-PDA寄存出库
|
||||
/// 模块标识-PDA扫码入库
|
||||
/// </summary>
|
||||
public const string MODULE_WMSSCANCODEINSTOCKPDA_ID = "28576495374869";
|
||||
/// <summary>
|
||||
|
||||
@@ -73,5 +73,9 @@ public partial class WmsAreaH : BaseEntity<string>
|
||||
/// 时间戳(用于并发控制)
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
/// <summary>
|
||||
/// 第三方设备类型
|
||||
/// </summary>
|
||||
public string third_eqp_type { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,4 +13,9 @@ public partial class WmsPretaskH : ITaskManagerDel
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int move_num { get; set; }
|
||||
/// <summary>
|
||||
/// 第三方设备类型
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string third_eqp_type { get; set; }
|
||||
}
|
||||
|
||||
@@ -8,5 +8,7 @@
|
||||
CTU = 1,
|
||||
KIVA = 2,
|
||||
AGV = 3,
|
||||
电梯 = 4,
|
||||
输送线 = 5,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace Tnb.WarehouseMgr
|
||||
try
|
||||
{
|
||||
Logger.Information($"任务链编号:{input.taskChainCode},状态:{input.status},设备ID:{input.deviceID}");
|
||||
switch (input.status)
|
||||
/*switch (input.status)
|
||||
{
|
||||
case "CREATED": break;
|
||||
case "ALLOCATED": break;
|
||||
@@ -242,9 +242,23 @@ namespace Tnb.WarehouseMgr
|
||||
case "FAILURE": break;
|
||||
case "FINISHED": break;
|
||||
default: break;
|
||||
}*/
|
||||
|
||||
|
||||
if (input.taskChainCode.Trim().IsNullOrEmpty())
|
||||
{
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
}
|
||||
//写入redis
|
||||
//await _cacheManager.SetAsync($"{input.taskChainCode}", $"任务链状态上报,上报状态{input.status}");
|
||||
|
||||
List<WmsDistaskH> disTasks = await _db.Queryable<WmsDistaskH>().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync();
|
||||
List<EqpEquipment> eps = await _db.Queryable<EqpEquipment>().Where(it => it.code.Contains(input.deviceID)).ToListAsync();
|
||||
TaskExecuteUpInput taskExecuteUpInput = new()
|
||||
{
|
||||
disTaskIds = disTasks.Select(x => x.id).ToList(),
|
||||
EqpIds = eps.Select(x => x.id).ToList(),
|
||||
};
|
||||
await _wareHouseService.TaskExecute(taskExecuteUpInput);
|
||||
|
||||
ConnectionConfigOptions opts = App.GetOptions<ConnectionConfigOptions>();
|
||||
UserAgent userAgent = new(App.HttpContext);
|
||||
//写系统日志
|
||||
@@ -321,6 +335,10 @@ namespace Tnb.WarehouseMgr
|
||||
return await ToApiResult(HttpStatusCode.InternalServerError, "请重试!");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
return await ToApiResult(HttpStatusCode.OK, "成功");
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,9 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<Configurations>Debug;Release;tianyi</Configurations>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'" />
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
|
||||
@@ -252,23 +252,26 @@ namespace Tnb.WarehouseMgr
|
||||
//获取所有未下发的预任务申请
|
||||
List<WmsPretaskH> preTasks = await db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
|
||||
.InnerJoin<WmsAreaH>((a, b, c) => a.area_id == c.id)
|
||||
.InnerJoin<BasLocation>((a, b, c, d) => a.endlocation_id == d.id && d.is_use == "0")
|
||||
.Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id))
|
||||
.OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code })
|
||||
.Select((a, b, c) => new WmsPretaskH
|
||||
.Select((a, b, c, d) => new WmsPretaskH
|
||||
{
|
||||
move_num = c.move_num
|
||||
move_num = c.move_num,
|
||||
third_eqp_type = c.third_eqp_type,
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
List<WmsPretaskH> agvElevatorTasks = preTasks
|
||||
.Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) &&
|
||||
!it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x=>x.endlocation_code).Contains(it.endlocation_code)).ToList();
|
||||
preTasks = preTasks.Where(it => !agvElevatorTasks.Select(x => x.endlocation_code).Contains(it.endlocation_code)).ToList();
|
||||
|
||||
IEnumerable<WmsPretaskH?> firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault());
|
||||
agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code));
|
||||
//agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)).DistinctBy(x=>x.endlocation_code).ToList();
|
||||
agvElevatorTasks = firstEleGrp?.ToList() ?? Enumerable.Empty<WmsPretaskH?>().ToList();
|
||||
preTasks = preTasks.Concat(agvElevatorTasks).ToList();
|
||||
|
||||
|
||||
|
||||
List<string> ids = preTasks.Select(x => x.id).Distinct().ToList();
|
||||
List<WmsPretaskCode>? preTaskCodes = await db.Queryable<WmsPretaskCode>().Where(it => ids.Contains(it.bill_id)).ToListAsync();
|
||||
@@ -290,24 +293,26 @@ namespace Tnb.WarehouseMgr
|
||||
int itemsCount = items.Count;
|
||||
int mod = itemsCount % moveNum > 0 ? (itemsCount / moveNum) + 1 : itemsCount / moveNum;
|
||||
WmsDistaskH[] arrary = items.ToArray();
|
||||
for (int i = 1; i <= mod; i++)
|
||||
//for (int i = 1; i <= mod; i++)
|
||||
{
|
||||
string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
|
||||
|
||||
if (moveNum >= 1)
|
||||
{
|
||||
List<WmsPretaskH> areaPreTasks = itGroup.ToList();
|
||||
|
||||
if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1))
|
||||
if (areaPreTasks.Any(x => x.third_eqp_type.ToEnum<EnumTaskChainType>() != EnumTaskChainType.CTU))
|
||||
{
|
||||
items.ForEach(x =>
|
||||
foreach (var x in items)
|
||||
{
|
||||
string groupCode = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).Result;
|
||||
x.is_chain = 0;
|
||||
});
|
||||
items[0].groups = groupCode;
|
||||
items[0].bill_code = $"{groupCode}-1";
|
||||
x.groups = groupCode;
|
||||
x.bill_code = $"{groupCode}-1";
|
||||
}
|
||||
}
|
||||
else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count)
|
||||
{
|
||||
string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE);
|
||||
items.ForEach(x => x.is_chain = 1);
|
||||
|
||||
int start = 0;
|
||||
@@ -385,7 +390,7 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
await db.Ado.CommitTranAsync();
|
||||
|
||||
if(_eleCtlCfg.Environment == ElevatorConsts.EnvironmentName)
|
||||
if (string.Equals(_eleCtlCfg.Environment, ElevatorConsts.EnvironmentName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
//呼梯操作
|
||||
//获取目标库位为电梯库位的任务
|
||||
@@ -824,6 +829,10 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = GenTaskExecute();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 出入库策略启用、禁用状态修改
|
||||
@@ -887,13 +896,12 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
row = await _db.Insertable(preTaskCodes).ExecuteCommandAsync();
|
||||
}
|
||||
//先注释 by ly on 20231025
|
||||
/* var eleP = preTasks.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
row = await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
*/
|
||||
var eleP = preTasks.Find(x => x.area_code.Contains("ELE"));
|
||||
if (eleP != null)
|
||||
{
|
||||
row = await _db.Updateable<WmsElevatorH>().SetColumns(it => it.task_nums == it.task_nums + 1).Where(it => it.area_code == eleP.area_code).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return row > 0;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -921,6 +929,10 @@ namespace Tnb.WarehouseMgr
|
||||
Expression<Func<WmsCarryH, bool>> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId;
|
||||
_ = await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync();
|
||||
}
|
||||
if (input.CarryStartLocationId.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
_ = await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
//根据所有库位更新库位的锁定状态为“锁定”
|
||||
if (setLocaionColumbExp != null && input.LocationIds?.Count > 0)
|
||||
{
|
||||
@@ -948,7 +960,7 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsPointH> points = await LocPathCalcAlgorithms(pStartId, pEndId, roads);
|
||||
try
|
||||
{
|
||||
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("ELE"))?.Count > 0)
|
||||
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
|
||||
{
|
||||
//查询当前电梯点
|
||||
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync();
|
||||
@@ -957,14 +969,16 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1);
|
||||
if (curEle == null)
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
throw new AppFriendlyException("电梯被禁用或未配置", 500);
|
||||
}
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync();
|
||||
|
||||
//判断电梯组中各电梯任务数
|
||||
if (sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
|
||||
if (curEle == null || sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0)
|
||||
{
|
||||
List<WmsElevatorD> sGpDs = await _db.Queryable<WmsElevatorD>().Where(it => it.bill_id == sGpEle.First().id).ToListAsync();
|
||||
if (sGpDs?.Count > 0)
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace Tnb.WarehouseMgr
|
||||
_ = await _db.Insertable(carryCodes).ExecuteCommandAsync();
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() });
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
if (instockCOdes?.Count > 0)
|
||||
{
|
||||
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace Tnb.WarehouseMgr
|
||||
// 更新临时条码表 状态is_end
|
||||
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, source_id = input.data[nameof(WmsOutstockH.source_id)].ToString(), source_code = input.data[nameof(WmsOutstockH.source_code)].ToString() },
|
||||
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() });
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
if (instockCOdes?.Count > 0)
|
||||
{
|
||||
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||
|
||||
@@ -308,7 +308,7 @@ namespace Tnb.WarehouseMgr
|
||||
//回更状态
|
||||
await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput,
|
||||
it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode },
|
||||
it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() });
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
_ = await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync();
|
||||
_ = await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync();
|
||||
|
||||
@@ -322,6 +322,10 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_ = InvokeGenPretaskExcute();
|
||||
}
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,15 +42,41 @@ namespace JNPF.TaskScheduler.Listener
|
||||
{
|
||||
|
||||
//整除表示一个周期到了
|
||||
// foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
// {
|
||||
// TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks);
|
||||
// TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd")).Ticks);
|
||||
// TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
// if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle) == 0)
|
||||
// {
|
||||
// tobeCreateTemplets.Add(item);
|
||||
// }
|
||||
// }
|
||||
|
||||
//按上一个保养记录来生成数据
|
||||
foreach (var item in eqpSpotInsTemEquipHsByCirculate)
|
||||
{
|
||||
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle) == 0)
|
||||
EqpMaintainRecordH eqpMaintainRecordH = await db.Queryable<EqpMaintainRecordH>().Where(x=>x.maintain_tem_equip_id==item.id).OrderByDescending(x=>x.create_time).FirstAsync();
|
||||
if (eqpMaintainRecordH == null)
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle) == 0)
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}else if (eqpMaintainRecordH.status!="1")
|
||||
{
|
||||
TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(eqpMaintainRecordH.execute_time.Value.ToString("yyyy-MM-dd")).Ticks);
|
||||
TimeSpan ts3 = ts1.Subtract(ts2).Duration();
|
||||
if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle) == 0)
|
||||
{
|
||||
tobeCreateTemplets.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user