using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Globalization; namespace Jingyao.AIEmployee { public sealed partial class PersonalInboxHandler { static PersonalInboxHandler() { RegisterMesLinkedRoutes(); RegisterMesCrossDomain(); NavigationRoutes.Add("ai_精工领料出库",new[] { "/mes/seiko-material-requisition" }); NavigationRoutes.Add("ai_精工生产执行",new[] { "/mes/seiko-production-execution" }); NavigationRoutes.Add("ai_精工完工复核",new[] { "/mes/seiko-completion-review" }); NavigationRoutes.Add("ai_报工申请与复核",new[] { "/mes/reporting-review" }); NavigationRoutes.Add("ai_开工前门禁",new[] { "/mes/reporting-review", "/mes/start-gate" }); NavigationRoutes.Add("ai_工单草稿审核",new[] { "/mes/work-order-draft-review", "/mes/dispatch-pool", "/mes/start-gate" }); NavigationRoutes.Add("ai_待派工池",new[] { "/mes/dispatch-pool", "/mes/start-gate" }); NavigationRoutes.Add("ai_APS下达待接收箱",new[] { "/mes/aps-receipt-inbox", "/mes/work-order-draft-review" }); NavigationRoutes.Add("ai_返工接收与重新送检",new[] { "/mes/rework-receipt" }); NavigationRoutes.Add("ai_返工接收与重新送检_NCR处置",new[] { "/mes/rework-receipt" }); NavigationRoutes.Add("ai_返工接收与重新送检_质量终判",new[] { "/mes/rework-receipt" }); NavigationRoutes.Add("ai_APS下达待接收箱_下达申请",new[] { "/mes/aps-receipt-inbox" }); NavigationRoutes.Add("ai_订单装配选型",new[] { "/mes/assembly-configuration" }); NavigationRoutes.Add("ai_订单装配选型_旧版选型",new[] { "/mes/assembly-configuration" }); NavigationRoutes.Add("ai_专机装配工作台_接管记录",new[] { "/mes/special-machine-workbench" }); NavigationRoutes.Add("ai_精工生产任务查询_订单选项",new[] { "/mes/seiko-production-task-query" }); NavigationRoutes.Add("ai_精工生产任务查询_产品选项",new[] { "/mes/seiko-production-task-query" }); NavigationRoutes.Add("ai_精工生产任务查询_任务清单",new[] { "/mes/seiko-production-task-query" }); NavigationRoutes.Add("ai_精工生产任务查询_工序追溯",new[] { "/mes/seiko-production-task-query" }); NavigationRoutes.Add("ai_MES制造执行_本人操作权限",new[] { "/mes/control-center", "/mes/seiko-production-task-query", "/mes/seiko-material-requisition", "/mes/seiko-production-execution", "/mes/seiko-completion-review", "/mes/seiko-partial-transfer", "/mes/assembly-configuration", "/mes/assembly-schedule", "/mes/assembly-rework", "/mes/assembly-material-flow", "/mes/special-machine-workbench", "/mes/special-machine-execution", "/mes/reporting-review", "/mes/internal-rework-domain-acceptance", "/mes/aps-receipt-inbox", "/mes/work-order-draft-review", "/mes/dispatch-pool", "/mes/start-gate", "/mes/rework-receipt" }); } static bool MesUnpaged(string name) { return name=="ai_精工生产任务查询_订单选项" || name=="ai_精工生产任务查询_产品选项" || name=="ai_精工生产任务查询_工序追溯" || name=="ai_MES制造执行_本人操作权限"; } static void MesOptional(SqlCommand command, Dictionary inputs,string key,SqlDbType type) { object raw; if (!inputs.TryGetValue(key,out raw) || raw==null || Object.Equals(raw,"")) return; object value; if (type==SqlDbType.DateTime) { DateTime date; if (!DateTime.TryParseExact(Convert.ToString(raw,Invariant),new[] {"yyyy-MM-dd","yyyy-MM-dd HH:mm:ss"},Invariant,DateTimeStyles.None,out date)) throw BadInput(); value=date; } else { long number; if (!Int64.TryParse(Convert.ToString(raw,Invariant),NumberStyles.None,Invariant,out number) || number<0 || (type==SqlDbType.Int && number>Int32.MaxValue) || (type==SqlDbType.Bit && number>1)) throw BadInput(); value=number; } command.Parameters.Add("@"+key,type).Value=value; } static bool BindMesQuery(SqlCommand command,string name,Dictionary inputs,Dictionary body) { if (BindMesLinkedQuery(command,name,inputs,body)) return true; switch(name) { case "ai_精工领料出库": Only(inputs ,"关键字","状态"); 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",300,25); return true; case "ai_精工生产执行": Only(inputs ,"关键字","状态"); 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",300,25); return true; case "ai_精工完工复核": Only(inputs ,"关键字","状态"); 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",300,25); return true; case "ai_报工申请与复核": Only(inputs ,"报工申请流水号","开工门禁流水号","状态"); MesOptional(command,inputs,"报工申请流水号",SqlDbType.BigInt); MesOptional(command,inputs,"开工门禁流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_开工前门禁": Only(inputs ,"开工门禁流水号","待派工流水号","状态"); MesOptional(command,inputs,"开工门禁流水号",SqlDbType.BigInt); MesOptional(command,inputs,"待派工流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_工单草稿审核": Only(inputs ,"工单审核流水号","MES工单草稿流水号","状态"); MesOptional(command,inputs,"工单审核流水号",SqlDbType.BigInt); MesOptional(command,inputs,"MES工单草稿流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_待派工池": Only(inputs ,"待派工流水号","工单审核流水号","状态"); MesOptional(command,inputs,"待派工流水号",SqlDbType.BigInt); MesOptional(command,inputs,"工单审核流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_APS下达待接收箱": Only(inputs ,"MES接收流水号","MES下达申请流水号","MES工单草稿流水号","状态"); MesOptional(command,inputs,"MES接收流水号",SqlDbType.BigInt); MesOptional(command,inputs,"MES下达申请流水号",SqlDbType.BigInt); MesOptional(command,inputs,"MES工单草稿流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_返工接收与重新送检": Only(inputs ,"返工接收流水号","返工候选流水号","状态"); MesOptional(command,inputs,"返工接收流水号",SqlDbType.BigInt); MesOptional(command,inputs,"返工候选流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_返工接收与重新送检_NCR处置": Only(inputs ,"NCR处置流水号","NCR候选流水号","状态"); MesOptional(command,inputs,"NCR处置流水号",SqlDbType.BigInt); MesOptional(command,inputs,"NCR候选流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_返工接收与重新送检_质量终判": Only(inputs ,"质量终判流水号","报工申请流水号","状态"); MesOptional(command,inputs,"质量终判流水号",SqlDbType.BigInt); MesOptional(command,inputs,"报工申请流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_APS下达待接收箱_下达申请": Only(inputs ,"MES下达申请流水号","发布执行流水号","状态"); MesOptional(command,inputs,"MES下达申请流水号",SqlDbType.BigInt); MesOptional(command,inputs,"发布执行流水号",SqlDbType.BigInt); 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",300,25); return true; case "ai_订单装配选型": Only(inputs ,"销售订单流水号","产品类别代码","状态","关键字"); MesOptional(command,inputs,"销售订单流水号",SqlDbType.BigInt); AddText(command,inputs,"产品类别代码",30,""); AddText(command,inputs,"状态",30,""); 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",300,25); return true; case "ai_订单装配选型_旧版选型": Only(inputs ,"关键字","产品类别代码"); 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",300,25); return true; case "ai_专机装配工作台_接管记录": Only(inputs ,"关键字","旧机床流水号","ERP项目流水号"); AddText(command,inputs,"关键字",200,""); MesOptional(command,inputs,"旧机床流水号",SqlDbType.Int); MesOptional(command,inputs,"ERP项目流水号",SqlDbType.Int); command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1); command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",300,25); return true; case "ai_精工生产任务查询_订单选项": Only(inputs); return true; case "ai_精工生产任务查询_产品选项": Only(inputs ,"订单流水号"); MesOptional(command,inputs,"订单流水号",SqlDbType.Int); return true; case "ai_精工生产任务查询_任务清单": Only(inputs ,"时间_check","开始时间","结束时间","订单流水号","订单流水号_check","组件流水号","组件流水号_check","零件名称_check","零件名称","图号_check","图号","状态流水号_check","状态流水号","排序名称","排序方式"); MesOptional(command,inputs,"时间_check",SqlDbType.Bit); MesOptional(command,inputs,"开始时间",SqlDbType.DateTime); MesOptional(command,inputs,"结束时间",SqlDbType.DateTime); MesOptional(command,inputs,"订单流水号",SqlDbType.Int); MesOptional(command,inputs,"订单流水号_check",SqlDbType.Int); MesOptional(command,inputs,"组件流水号",SqlDbType.Int); MesOptional(command,inputs,"组件流水号_check",SqlDbType.Int); MesOptional(command,inputs,"零件名称_check",SqlDbType.Int); AddText(command,inputs,"零件名称",50,""); MesOptional(command,inputs,"图号_check",SqlDbType.Int); AddText(command,inputs,"图号",50,""); MesOptional(command,inputs,"状态流水号_check",SqlDbType.Bit); AddText(command,inputs,"状态流水号",50,""); MesOptional(command,inputs,"排序名称",SqlDbType.Int); MesOptional(command,inputs,"排序方式",SqlDbType.Int); command.Parameters.Add("@页码",SqlDbType.Int).Value=(int)Positive(body,"pageList",100000,1); command.Parameters.Add("@每页条数",SqlDbType.Int).Value=(int)Positive(body,"pageSize",300,25); return true; case "ai_精工生产任务查询_工序追溯": Only(inputs ,"工艺计划流水号"); MesOptional(command,inputs,"工艺计划流水号",SqlDbType.Int); return true; case "ai_MES制造执行_本人操作权限": Only(inputs); return true; default: return false; } } } }