This commit is contained in:
2023-11-23 15:53:18 +08:00
7 changed files with 75 additions and 21 deletions

View File

@@ -30,6 +30,7 @@ namespace Tnb.ProductionMgr
private readonly IUserManager _userManager;
private readonly IPrdMoTaskService _prdMoTaskService;
private readonly IBillRullService _billRullService;
private readonly IDictionaryDataService _dictionaryDataService;
// private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
@@ -39,6 +40,7 @@ namespace Tnb.ProductionMgr
IBillRullService billRullService,
IPrdMoTaskService prdMoTaskService,
// WmsSignForDeliveryService wmsSignForDeliveryService,
IDictionaryDataService dictionaryDataService,
IUserManager userManager
)
{
@@ -46,6 +48,7 @@ namespace Tnb.ProductionMgr
_userManager = userManager;
_prdMoTaskService = prdMoTaskService;
// _wmsSignForDeliveryService = _wmsSignForDeliveryService;
_dictionaryDataService = dictionaryDataService;
_billRullService = billRullService;
}
@@ -522,7 +525,9 @@ namespace Tnb.ProductionMgr
string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
// DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
// DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
Dictionary<string, object> dic = await _dictionaryDataService.GetDicByKey(DictConst.DOCUMENTSTATU);
if (string.IsNullOrEmpty(input.sidx))
{
input.sidx = "create_time";
@@ -555,7 +560,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id)
.Where((a,b)=>a.workstation_id==input.stationId)
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode))
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(SqlFunc.IsNull(e.EnCode,a.status)))
.Select((a, b,c,d,e) => new FeedingRecordListOutput()
{
id = a.id,
@@ -564,7 +569,7 @@ namespace Tnb.ProductionMgr
type = "0",
create_name = b.RealName,
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
status = e.FullName
status = SqlFunc.IsNull(e.FullName,a.status)
});
var queryable2 = db.Queryable<PrdOutstockH>()
@@ -573,7 +578,7 @@ namespace Tnb.ProductionMgr
.LeftJoin<DictionaryTypeEntity>((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU)
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id)
.Where((a,b)=>a.workstation_id==input.stationId)
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode))
.WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(SqlFunc.IsNull(e.EnCode,a.status)))
.Select((a, b,c,d,e) => new FeedingRecordListOutput()
{
id = a.id,
@@ -582,11 +587,18 @@ namespace Tnb.ProductionMgr
type = a.type,
create_name = b.RealName,
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
status = e.FullName
status = SqlFunc.IsNull(e.FullName,a.status)
});
var result = await db.UnionAll(queryable1,queryable2)
.MergeTable()
.OrderBy($"{input.sidx} {input.sort}")
.Mapper(a =>
{
if (dic.ContainsKey(a.status))
{
a.status = dic[a.status].ToString();
}
})
.ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<FeedingRecordListOutput>.SqlSugarPageResult(result);

View File

@@ -199,7 +199,7 @@ namespace Tnb.ProductionMgr
});
}
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
string domain = _userManager.Domain;
Dictionary<string, object> header = new()
{
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -397,7 +397,7 @@ namespace Tnb.ProductionMgr
});
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = "http://localhost:9232";
string domain = "http://tnb.tuotong-tech.com";
string domain = _userManager.Domain;
Dictionary<string, object> header = new()
{
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -508,7 +508,7 @@ namespace Tnb.ProductionMgr
// codeqty = (int)prdReport.reported_qty,
// });
// // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
// string domain = "http://tnb.tuotong-tech.com";
// string domain = _userManager.Domain;
// Dictionary<string, object> header = new()
// {
// // ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -588,7 +588,8 @@ namespace Tnb.ProductionMgr
string location_code = basLocation.location_code;
PrdReport prdReport = await db.Queryable<PrdReport>()
.Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time)
.LeftJoin<BasMaterial>((x,y)=>x.material_id==y.id)
.Where((x,y) => y.category_id.Contains("\"DGJCJ\"") && x.status == 0).OrderByDescending(x => x.create_time)
.FirstAsync();
BasMaterial basMaterial = await db.Queryable<BasMaterial>().SingleAsync(x => x.id == prdReport.material_id);
@@ -653,7 +654,7 @@ namespace Tnb.ProductionMgr
material_id = prdReport.material_id,
material_code = basMaterial.code,
unit_id = prdReport.unit_id,
code_batch = prdReport.barcode,
code_batch = prdReport.mo_task_code,
pr_qty = (int)prdReport.reported_qty,
});
@@ -667,7 +668,9 @@ namespace Tnb.ProductionMgr
codeqty = (int)prdReport.reported_qty,
});
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
// string domain = _userManager.Domain;
// string domain = "http://localhost:9232";
string domain = _userManager.Domain;
Dictionary<string, object> header = new()
{
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
@@ -781,7 +784,7 @@ namespace Tnb.ProductionMgr
codeqty = (int)prdReport.reported_qty,
});
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
string domain = _userManager.Domain;
// string domain = "http://localhost:9232";
Dictionary<string, object> header = new()
{
@@ -971,7 +974,7 @@ namespace Tnb.ProductionMgr
}
// string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
string domain = "http://tnb.tuotong-tech.com";
string domain = _userManager.Domain;
Dictionary<string, object> header = new()
{
// ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]

View File

@@ -5,9 +5,9 @@
/// </summary>
public enum EnumTaskChainType
{
AGV = 1,
CTU = 1,
KIVA = 2,
CTU = 3,
AGV = 3,
= 4,
线 = 5,
}

View File

@@ -238,14 +238,17 @@ namespace Tnb.WarehouseMgr
List<WmsElevatorH> elevatorList = await db.Queryable<WmsElevatorH>().InnerJoin<WmsElevatorD>((a, b) => a.id == b.bill_id)
.Select((a, b) => new WmsElevatorH
{
bill_id = b.bill_id,
location_id = b.location_id,
location_code = b.location_code,
point_id = b.point_id,
point_code = b.point_code,
floor = b.floor
}, true).ToListAsync();
Logger.Information($"elevatorList:{JsonConvert.SerializeObject(elevatorList)}");
//获取所有未下发的预任务申请
List<WmsPretaskH> preTasks = await db.Queryable<WmsPretaskH>().InnerJoin<WmsCarryH>((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id)
@@ -370,6 +373,9 @@ namespace Tnb.WarehouseMgr
if (endPointIds?.Count > 0)
{
elevatorList = elevatorList.FindAll(x => endPointIds.Contains(x.point_id));
Logger.Information($"过滤后的elevatorList{JsonConvert.SerializeObject(elevatorList)}");
if (elevatorList?.Count > 0)
{
foreach (WmsElevatorH? e in elevatorList)
@@ -460,11 +466,12 @@ namespace Tnb.WarehouseMgr
private async Task CallingLanding(List<(string endlocation_code, string device_id, string id, string floorNO)> endLocCodes)
{
Logger.Information($" 开始呼梯操作.............");
Logger.Information($"电梯信息:{JsonConvert.SerializeObject(s_elevatorMap)}");
try
{
foreach ((_, string devId, string disTaskId, string floorNO) in endLocCodes)
{
Logger.Information($"devId:{devId}");
if (!s_elevatorMap.TryGetValue(devId, out object? elevatorCode))
{
continue;
@@ -1041,22 +1048,18 @@ namespace Tnb.WarehouseMgr
{
if (points.FindAll(x => x.location_code != null && x.location_code.Contains("dt", StringComparison.OrdinalIgnoreCase))?.Count > 0)
{
Logger.Information("获取当前电梯点");
//查询当前电梯点
List<WmsElevatorD> curEleDs = await _db.Queryable<WmsElevatorD>().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync();
Logger.Information($"当前电梯点:{string.Join(",",curEleDs.Select(x=>x.point_code))}");
//如果有电梯点,则会进行电梯的均匀分配
if (curEleDs?.Count > 0)
{
//当前电梯
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
Logger.Debug($"档期电梯信息:{JsonConvert.SerializeObject(curEle)}");
//同电梯组电梯
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
Logger.Debug($"同电梯组电梯:{JsonConvert.SerializeObject(sGpEle)}");
if (curEle == null && sGpEle?.Count > 0)
{

View File

@@ -57,7 +57,7 @@ public class Startup : AppStartup
//定时任务
services.AddHostedService<TimedTaskBackgroundService>();
services.AddHostedService<RedisBackGround>();
//services.AddHostedService<RedisBackGround>();
}

View File

@@ -161,4 +161,9 @@ public interface IUserManager
/// 获取管理员用户id.
/// </summary>
string GetAdminUserId();
/// <summary>
/// 域名
/// </summary>
string Domain{ get; }
}

View File

@@ -6,5 +6,36 @@
public partial class UserManager
{
public static string AsscessToken { get; set; }
public string Domain
{
get
{
try
{
string host = "";
if (App.HttpContext != null)
{
host = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
}
else
{
var datatable = _repository.AsSugarClient().Ado
.GetDataTable("select * from bas_factory_config where key='domain' limit 1");
if (datatable.Rows.Count > 0)
{
host = datatable.Rows[0]["value"].ToString();
Console.WriteLine(host);
}
}
return host;
}
catch (Exception e)
{
return "http://tnb.tuotong-tech.com";
}
}
}
}