diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs
new file mode 100644
index 00000000..d47f3649
--- /dev/null
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs
@@ -0,0 +1,23 @@
+namespace Tnb.BasicData.Interfaces
+{
+
+ ///
+ /// 二维码
+ ///
+ public interface IBasQrcodeService
+ {
+ ///
+ /// 根据code获取qrcode
+ ///
+ ///
+ ///
+ public Task GetQrcodeByCode(Dictionary dic);
+
+ ///
+ /// 根据code获取工位信息
+ ///
+ ///
+ ///
+ public Task GetWorkStationByCode(Dictionary dic);
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasQrcodeService.cs b/BasicData/Tnb.BasicData/BasQrcodeService.cs
new file mode 100644
index 00000000..0c51d040
--- /dev/null
+++ b/BasicData/Tnb.BasicData/BasQrcodeService.cs
@@ -0,0 +1,84 @@
+using JNPF.Common.Core.Manager;
+using JNPF.DependencyInjection;
+using JNPF.DynamicApiController;
+using JNPF.Systems.Entitys.Permission;
+using JNPF.Systems.Interfaces.System;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+using Tnb.BasicData.Entities;
+using Tnb.BasicData.Entities.Dto;
+using Tnb.BasicData.Entitys.Dto.BasProcess;
+using Tnb.BasicData.Interfaces;
+using Tnb.EquipMgr.Entities;
+
+namespace Tnb.BasicData
+{
+ ///
+ /// 二维码
+ ///
+ [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)]
+ [Route("api/[area]/[controller]/[action]")]
+ public class BasQrcodeService : IBasQrcodeService,IDynamicApiController, ITransient
+ {
+ private readonly ISqlSugarRepository _repository;
+ private readonly DataBaseManager _dbManager;
+ private readonly IDictionaryDataService _dictionaryDataService;
+
+ public BasQrcodeService(
+ ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService)
+ {
+ _repository = repository;
+ _dbManager = dbManager;
+ _dictionaryDataService = dictionaryDataService;
+ }
+
+ [HttpPost]
+ public async Task GetQrcodeByCode(Dictionary dic)
+ {
+ string code = dic.ContainsKey("code") ? dic["code"] : "";
+ if (string.IsNullOrEmpty(code)) return null;
+ var result = await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.source_id == b.Id)
+ .LeftJoin((a, b, c) => a.source_id == c.id)
+ .LeftJoin((a, b, c, d) => a.source_id == d.id)
+ .Where((a, b, c, d) => a.code == code)
+ .Select((a, b, c, d) => new
+ {
+ id = a.id,
+ source_id = a.source_id,
+ source_name = a.source_name,
+ org_code = b.EnCode,
+ org_name = b.FullName,
+ equip_code = a.code,
+ equip_name = c.name,
+ tool_location_code = d.location_code,
+ }).FirstAsync();
+ return result;
+ }
+
+ [HttpPost]
+ public async Task GetWorkStationByCode(Dictionary dic)
+ {
+ string code = dic.ContainsKey("code") ? dic["code"] : "";
+ if (string.IsNullOrEmpty(code)) return null;
+ var result = await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.source_id == b.Id)
+ .LeftJoin((a,b,c)=>a.source_id==c.ObjectId && c.ObjectType=="Eqp")
+ .LeftJoin((a,b,c,d)=>c.OrganizeId==d.Id)
+ .Where((a, b, c) => a.code == code)
+ .Select((a, b, c,d) => new
+ {
+ id = a.id,
+ source_id = a.source_id,
+ source_name = a.source_name,
+ org_id = b.Id,
+ org_code = b.EnCode,
+ org_name = b.FullName,
+ org_id2 = d.Id,
+ org_code2 = d.EnCode,
+ org_name2 = d.FullName,
+ }).FirstAsync();
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/Tnb.BasicData.csproj b/BasicData/Tnb.BasicData/Tnb.BasicData.csproj
index 5ce642a8..b53e3d81 100644
--- a/BasicData/Tnb.BasicData/Tnb.BasicData.csproj
+++ b/BasicData/Tnb.BasicData/Tnb.BasicData.csproj
@@ -9,6 +9,7 @@
+
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs
index 99c5bcb4..736f3fe4 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs
@@ -31,5 +31,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 工序
///
public string process { get; set; }
+ ///
+ /// 工位id
+ ///
+ public string stationId { get; set; }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index 0158bfca..dca6214a 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -678,6 +678,13 @@ namespace Tnb.ProductionMgr
moTask.scheduled_qty = input.scheduled_qty;
moTask.unit_id = mo.unit_id;
+ if (!string.IsNullOrEmpty(input.eqp_id))
+ {
+ OrganizeRelationEntity organizeRelationEntity = await db.Queryable()
+ .Where(x => x.ObjectId == input.eqp_id && x.ObjectType == "Eqp").FirstAsync();
+ moTask.workstation_id = organizeRelationEntity?.OrganizeId ?? "";
+ }
+
var moCode = mo?.mo_code;
var taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE);
moTask.mo_task_code = taskCode;
@@ -944,10 +951,19 @@ namespace Tnb.ProductionMgr
.ToListAsync();
if (subTaskList?.Count > 0)
{
+ List workstationIds = await _db.Queryable().Where(x =>
+ x.Category == DictConst.RegionCategoryStationCode &&
+ x.OrganizeIdTree.Contains(input.workline_id)).Select(x=>x.Id).ToListAsync();
+
+
List subMoTasks = new();
List subMoTaskLogs = new();
foreach (var item in subTaskList)
{
+ BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x=>x.id==item.mbom_process_id);
+ List mbomProcessStationIds = JsonConvert.DeserializeObject(basMbomProcess.station).Select(x=>x[x.Length-1]).ToList();
+ List? resultList = workstationIds.Intersect(mbomProcessStationIds).ToList();
+
PrdMoTask subMoTask = new();
subMoTask.mo_id = input.mo_id;
subMoTask.material_id = item.material_id;
@@ -956,6 +972,7 @@ namespace Tnb.ProductionMgr
subMoTask.bom_id = input.bom_id;
subMoTask.process_id = item.process_id;
subMoTask.mbom_process_id = item.mbom_process_id;
+ subMoTask.workstation_id = resultList?.FirstOrDefault() ?? "";
subMoTask.mo_task_status = DictConst.ToBeScheduledEncode;
subMoTask.workroute_id = item.route_id;
subMoTask.workline_id = input.workline_id;
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
index 62cf4e1d..91ccecbf 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs
@@ -49,6 +49,8 @@ namespace Tnb.ProductionMgr
public async Task GetList(PrdPackReportQueryInput input)
{
if (input == null) throw new ArgumentNullException("input");
+ if (string.IsNullOrEmpty(input.stationId)) return Array.Empty();
+
List trees = new();
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
var list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync();
@@ -75,13 +77,17 @@ namespace Tnb.ProductionMgr
endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]);
}
- var items = await _db.Queryable().LeftJoin((a, b) => a.process_id == b.id).LeftJoin((a, b, c) => a.mo_id == c.id)
+ var items = await _db.Queryable()
+ .LeftJoin((a, b) => a.process_id == b.id)
+ .LeftJoin((a, b, c) => a.mo_id == c.id)
+ .LeftJoin((a,b,c,d)=>a.id==d.parent_id)
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
// .WhereIF(start, a => a.estimated_start_date != null&& startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date)
// .WhereIF(end, a => a.estimated_end_date != null && 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")
- .OrderByDescending(a=>a.create_time)
+ .Where((a,b,c,d)=>d.workstation_id==input.stationId)
+ .OrderByDescending(a=>a.create_time)
.Select((a, b, c) => new PrdMoTask
{
id = a.id,
@@ -122,7 +128,7 @@ namespace Tnb.ProductionMgr
}
node.plan_start_date = item.plan_start_date.HasValue ? item.plan_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
node.plan_end_date = item.plan_end_date.HasValue ? item.plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
- await GetChild(item.id, trees, dic);
+ await GetChild(item.id, trees, dic,input.stationId);
trees.Add(node);
}
}
@@ -170,13 +176,13 @@ namespace Tnb.ProductionMgr
return dt;
}
- private async Task GetChild(string parentId, List nodes, Dictionary dic)
+ private async Task GetChild(string parentId, List nodes, Dictionary dic,string stationId)
{
var items = await _db.Queryable()
.LeftJoin((a, b) => a.process_id == b.id)
.LeftJoin((a, b, c) => a.mo_id == c.id)
.LeftJoin((a, b, c, d) => a.mbom_process_id == d.id)
- .Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled")
+ .Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled" && a.workstation_id==stationId)
.OrderBy((a, b, c, d) => d.ordinal)
.Select((a, b, c) => new PrdMoTask
{
@@ -222,7 +228,7 @@ namespace Tnb.ProductionMgr
nodes.AddRange(nsChild);
foreach (var item in items)
{
- await GetChild(item.id, nodes, dic);
+ await GetChild(item.id, nodes, dic,stationId);
}
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
index d3903b74..341427ce 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs
@@ -119,6 +119,13 @@ namespace Tnb.ProductionMgr
var db = _repository.AsSugarClient();
Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary();
string moTaskCode = queryJson!=null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
+ string stationId = queryJson!=null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : "";
+
+ if (string.IsNullOrEmpty(stationId))
+ {
+ return Array.Empty();
+ }
+
Dictionary dic = await _dictionaryDataService.GetDicByKey(DictConst.TaskStatus);
DateTime[] planStartDateArr = null;
@@ -142,6 +149,7 @@ namespace Tnb.ProductionMgr
.WhereIF(!string.IsNullOrEmpty(moTaskCode),(a,b,c,d)=>a.mo_task_code.Contains(moTaskCode))
.WhereIF(planStartDateArr!=null, (a, b, c, d) => a.estimated_start_date>=planStartDateArr[0] && a.estimated_start_date<=planStartDateArr[1])
.WhereIF(planEndDateArr!=null, (a, b, c, d) => a.estimated_end_date>=planEndDateArr[0] && a.estimated_end_date<=planEndDateArr[1])
+ .Where((a,b,c,d)=>a.workstation_id==stationId)
.OrderByDescending((a, b, c, d) => a.create_time)
.Select((a, b, c, d) => new PrdTaskManageListOutput()
{