예제 #1
0
        /// <summary>
        ///  LES-WMS-005	入库数据 WL004
        // <param name="logFid"></param>
        public static ExecuteResultConstants SendInboundOrder
            (Guid logFid, InterfaceConfigInfo interfaceConfigInfo,
            ref string errorCode, ref string errorMsg, out string msgContent)
        {
            msgContent = string.Empty;
            List <WmsTranOutInfo> vmiInboundOrderInfos = new WmsTranOutBLL().GetList("[LOG_FID] = N'" + logFid + "' and [PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (vmiInboundOrderInfos.Count == 0)
            {
                errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认
                return(ExecuteResultConstants.Exception);
            }

            ///发送内容
            List <BFDAVmiInboundDataInfo> bFDAVmiInboundDataInfos = new List <BFDAVmiInboundDataInfo>();

            foreach (var VmiInboundDataInfo in vmiInboundOrderInfos)
            {
                bFDAVmiInboundDataInfos.Add(GetBFDAVMIInfo(VmiInboundDataInfo));
            }
            BFDAVMISendDataInfo <BFDAVmiInboundDataInfo> sendDataInfo = new BFDAVMISendDataInfo <BFDAVmiInboundDataInfo>();

            sendDataInfo.List = bFDAVmiInboundDataInfos;

            ///
            WsProcessServiceClient client = new WsProcessServiceClient();

            client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl);
            ///1标识成功、0标识失败
            long tenantId = 89;

            if (!long.TryParse(interfaceConfigInfo.Param2, out tenantId))
            {
                errorCode = "MC:3x00000021";///接口配置错误
                return(ExecuteResultConstants.Exception);
            }

            ///数据发送
            msgContent = new XmlWrapper().ObjectToXml(sendDataInfo, false);
            Log.WriteLogToFile(msgContent, AppDomain.CurrentDomain.BaseDirectory + @"\logContent\", DateTime.Now.ToString("yyyyMMddHHmm") + interfaceConfigInfo.SysMethodName);

            string result = client.runProcessWithAction(interfaceConfigInfo.Param1, tenantId, interfaceConfigInfo.SysMethodName, msgContent);

            BFDAVMIResultInfo resultInfo = new XmlWrapper(result, LoadType.FromString).XmlToObject("/Result", typeof(BFDAVMIResultInfo)) as BFDAVMIResultInfo;

            // throw new Exception(resultInfo.Status); TDD: delete
            ///成功后更新中间表数据处理状态
            if (resultInfo.Status.ToLower() == "error")
            {
                errorCode = resultInfo.ErrorCode;
                errorMsg  = resultInfo.ErrorMsg;
                return(ExecuteResultConstants.Error);
            }
            Log.WriteLogToFile("END: " + ExecuteResultConstants.Success, AppDomain.CurrentDomain.BaseDirectory + @"\log\", DateTime.Now.ToString("yyyyMMddHHmm"));

            return(ExecuteResultConstants.Success);
        }
예제 #2
0
        /// <summary>
        /// LES-SRM-004 排序拉动单
        // <param name="logFid"></param>
        public static ExecuteResultConstants SendJisPullOrder(Guid logFid, InterfaceConfigInfo interfaceConfigInfo,
                                                              ref string errorCode, ref string errorMsg, out string msgContent)
        {
            msgContent = string.Empty;
            List <WmsVmiJisPullOrderInfo> vmiJisPullOrderInfos = new WmsVmiJisPullOrderBLL().GetList("[LOG_FID] = N'" + logFid + "' and [PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (vmiJisPullOrderInfos.Count == 0)
            {
                errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认
                return(ExecuteResultConstants.Exception);
            }

            ///发送内容
            List <BFDAVmiJisPullOrderInfo> inboundOrderInfos = new List <BFDAVmiJisPullOrderInfo>();

            foreach (var vmiJisPullOrderInfo in vmiJisPullOrderInfos)
            {
                inboundOrderInfos.Add(GetBFDAInfo(vmiJisPullOrderInfo));
            }
            BFDAVMISendDataInfo <BFDAVmiJisPullOrderInfo> sendDataInfo = new BFDAVMISendDataInfo <BFDAVmiJisPullOrderInfo>();

            sendDataInfo.List = inboundOrderInfos;

            WsProcessServiceClient client = new WsProcessServiceClient();

            client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl);
            ///1标识成功、0标识失败
            long tenantId = 89;

            if (!long.TryParse(interfaceConfigInfo.Param2, out tenantId))
            {
                errorCode = "MC:3x00000021";///接口配置错误
                return(ExecuteResultConstants.Exception);
            }
            ///数据发送
            msgContent = new XmlWrapper().ObjectToXml(sendDataInfo, false);

            string result = client.runProcessWithAction(interfaceConfigInfo.Param1, tenantId, interfaceConfigInfo.SysMethodName, msgContent);

            BFDAVMIResultInfo resultInfo = new XmlWrapper(result, LoadType.FromString).XmlToObject("/Result", typeof(BFDAVMIResultInfo)) as BFDAVMIResultInfo;

            ///成功后更新中间表数据处理状态
            if (resultInfo.Status.ToLower() == "error")
            {
                errorCode = resultInfo.ErrorCode;
                errorMsg  = resultInfo.ErrorMsg;
                return(ExecuteResultConstants.Error);
            }
            return(ExecuteResultConstants.Success);
        }