143 lines
9.4 KiB
C#
143 lines
9.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace Jingyao.AIEmployee
|
|
{
|
|
public sealed partial class PersonalInboxHandler
|
|
{
|
|
static readonly Dictionary<string,string[]> MesResultSets = new Dictionary<string,string[]>(StringComparer.Ordinal) {
|
|
{ "ai_订单装配选型_配置详情", new[] { "record", "options", "values", "snapshots", "cascades" } },
|
|
{ "ai_订单装配选型_传动方式联动候选", new[] { "rows" } },
|
|
{ "ai_专机装配工作台_BOM版本", new[] { "rows" } },
|
|
{ "ai_专机装配工作台_工程变更", new[] { "rows" } },
|
|
{ "ai_专机装配工作台_版本门禁", new[] { "rows" } },
|
|
{ "ai_专机工作包执行", new[] { "summary", "tasks", "materials", "requests", "transitions", "movements" } },
|
|
{ "ai_专机装配工作台_项目工作包", new[] { "record", "packages", "materials", "receiptTasks" } },
|
|
{ "ai_组装排产与派工", new[] { "summary", "plans", "sourceSummary", "sources", "preparationSummary", "preparations" } },
|
|
{ "ai_组装返工待办", new[] { "rows", "summary" } },
|
|
{ "ai_装配领补退料_装配计划", new[] { "summary", "tasks", "materials", "requests", "postings" } },
|
|
{ "ai_装配领补退料_工单草稿", new[] { "summary", "tasks", "materials", "requests", "postings" } },
|
|
{ "ai_精工分批接收_任务依据", new[] { "rows" } },
|
|
{ "ai_专机装配工作台_投产接收人", new[] { "rows" } },
|
|
{ "ai_专机装配工作台_旧专机在制", new[] { "orders", "components" } }
|
|
};
|
|
static void RegisterMesLinkedRoutes()
|
|
{
|
|
NavigationRoutes.Add("ai_订单装配选型_配置详情", new[] { "/mes/assembly-configuration" });
|
|
NavigationRoutes.Add("ai_订单装配选型_传动方式联动候选", new[] { "/mes/assembly-configuration" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_BOM版本", new[] { "/mes/special-machine-workbench" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_工程变更", new[] { "/mes/special-machine-workbench" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_版本门禁", new[] { "/mes/special-machine-workbench" });
|
|
NavigationRoutes.Add("ai_专机工作包执行", new[] { "/mes/special-machine-execution" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_项目工作包", new[] { "/mes/special-machine-workbench" });
|
|
NavigationRoutes.Add("ai_组装排产与派工", new[] { "/mes/assembly-schedule" });
|
|
NavigationRoutes.Add("ai_组装返工待办", new[] { "/mes/assembly-rework" });
|
|
NavigationRoutes.Add("ai_装配领补退料_装配计划", new[] { "/mes/assembly-schedule", "/mes/assembly-material-flow" });
|
|
NavigationRoutes.Add("ai_装配领补退料_工单草稿", new[] { "/mes/assembly-material-flow", "/mes/assembly-schedule" });
|
|
NavigationRoutes.Add("ai_精工分批接收_任务依据", new[] { "/mes/seiko-partial-transfer" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_投产接收人", new[] { "/mes/assembly-configuration", "/mes/assembly-schedule", "/mes/special-machine-workbench", "/mes/special-machine-execution" });
|
|
NavigationRoutes.Add("ai_专机装配工作台_旧专机在制", new[] { "/mes/special-machine-workbench" });
|
|
}
|
|
static bool BindMesLinkedQuery(SqlCommand command,string name,Dictionary<string,object> inputs,Dictionary<string,object> body)
|
|
{
|
|
switch(name) {
|
|
case "ai_订单装配选型_配置详情":
|
|
Only(inputs, "订单配置流水号");
|
|
MesOptional(command,inputs,"订单配置流水号",SqlDbType.BigInt);
|
|
return true;
|
|
case "ai_订单装配选型_传动方式联动候选":
|
|
Only(inputs, "订单配置流水号", "上游选项代码", "上游选项值代码");
|
|
MesOptional(command,inputs,"订单配置流水号",SqlDbType.BigInt);
|
|
AddText(command,inputs,"上游选项代码",50,"");
|
|
AddText(command,inputs,"上游选项值代码",100,"");
|
|
return true;
|
|
case "ai_专机装配工作台_BOM版本":
|
|
Only(inputs, "Keyword", "VersionStatus");
|
|
AddText(command,inputs,"Keyword",100,"");
|
|
AddText(command,inputs,"VersionStatus",20,"");
|
|
return true;
|
|
case "ai_专机装配工作台_工程变更":
|
|
Only(inputs, "Keyword", "ChangeStatus");
|
|
AddText(command,inputs,"Keyword",100,"");
|
|
AddText(command,inputs,"ChangeStatus",30,"");
|
|
return true;
|
|
case "ai_专机装配工作台_版本门禁":
|
|
Only(inputs, "Keyword", "GateStatus");
|
|
AddText(command,inputs,"Keyword",100,"");
|
|
AddText(command,inputs,"GateStatus",20,"");
|
|
return true;
|
|
case "ai_专机工作包执行":
|
|
Only(inputs, "专机工作包接收任务流水号", "ERP项目流水号", "关键词", "状态");
|
|
MesOptional(command,inputs,"专机工作包接收任务流水号",SqlDbType.BigInt);
|
|
MesOptional(command,inputs,"ERP项目流水号",SqlDbType.Int);
|
|
AddText(command,inputs,"关键词",200,"");
|
|
AddText(command,inputs,"状态",40,"");
|
|
command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1);
|
|
command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",200,25);
|
|
return true;
|
|
case "ai_专机装配工作台_项目工作包":
|
|
Only(inputs, "ERP项目流水号");
|
|
MesOptional(command,inputs,"ERP项目流水号",SqlDbType.Int);
|
|
return true;
|
|
case "ai_组装排产与派工":
|
|
Only(inputs, "关键词");
|
|
AddText(command,inputs,"关键词",200,"");
|
|
command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1);
|
|
command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",100,25);
|
|
return true;
|
|
case "ai_组装返工待办":
|
|
Only(inputs, "仅待办");
|
|
MesOptional(command,inputs,"仅待办",SqlDbType.Bit);
|
|
command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1);
|
|
command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",50,25);
|
|
return true;
|
|
case "ai_装配领补退料_装配计划":
|
|
Only(inputs, "装配计划流水号", "关键词");
|
|
MesOptional(command,inputs,"装配计划流水号",SqlDbType.BigInt);
|
|
AddText(command,inputs,"关键词",200,"");
|
|
command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1);
|
|
command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",100,25);
|
|
return true;
|
|
case "ai_装配领补退料_工单草稿":
|
|
Only(inputs, "MES工单草稿流水号", "机械任务流水号", "关键词", "状态");
|
|
MesOptional(command,inputs,"MES工单草稿流水号",SqlDbType.BigInt);
|
|
MesOptional(command,inputs,"机械任务流水号",SqlDbType.BigInt);
|
|
AddText(command,inputs,"关键词",200,"");
|
|
AddText(command,inputs,"状态",30,"");
|
|
command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1);
|
|
command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",200,25);
|
|
return true;
|
|
case "ai_精工分批接收_任务依据":
|
|
Only(inputs, "后序任务");
|
|
MesOptional(command,inputs,"后序任务",SqlDbType.Int);
|
|
return true;
|
|
case "ai_专机装配工作台_投产接收人":
|
|
Only(inputs, "目标代码");
|
|
AddText(command,inputs,"目标代码",40,"");
|
|
return true;
|
|
case "ai_专机装配工作台_旧专机在制":
|
|
Only(inputs, "关键词");
|
|
AddText(command,inputs,"关键词",200,"");
|
|
return true;
|
|
default: return false;
|
|
}
|
|
}
|
|
static List<Dictionary<string,object>> ReadMesLinkedQuery(SqlDataReader reader,string[] sets)
|
|
{
|
|
var result=new List<Dictionary<string,object>>();
|
|
foreach(string set in sets) {
|
|
if (set!=sets[0] && !reader.NextResult()) throw Unavailable();
|
|
foreach(var row in ReadRows(reader,100000)) {
|
|
row.Add("结果集",set);
|
|
FormatMesBinaryFields(row);
|
|
result.Add(row);
|
|
}
|
|
}
|
|
if(reader.NextResult()) throw Unavailable();
|
|
return result;
|
|
}
|
|
}
|
|
}
|