예제 #1
0
        /// <summary>
        /// 转换为中间集合
        /// </summary>
        /// <param name="sapProductOrderBomInfos"></param>
        /// <returns></returns>
        public List <SapProductOrderBomInfo> ConversionToCentreList(List <BFDASapProductOrderBomInfo> sapProductOrderBomInfos)
        {
            ///订单BOM
            List <SapProductOrderBomInfo> productOrderBomInfos = new List <SapProductOrderBomInfo>();

            foreach (BFDASapProductOrderBomInfo sapProductOrderBomInfo in sapProductOrderBomInfos)
            {
                SapProductOrderBomInfo productOrderBomInfo = ConversionToCentreInfo(sapProductOrderBomInfo);
                productOrderBomInfos.Add(productOrderBomInfo);
            }
            var qProductOrderBomInfos =
                from u in productOrderBomInfos
                orderby u.Aufnr
                group u by new { u.Fmatnr, u.Dwerk, u.Aufnr, u.Verid, u.OnlineDate, u.OfflineDate, u.Zzdd }
            into g
                select new { g.Key };
            List <SapProductOrderBomInfo> list = new List <SapProductOrderBomInfo>();

            foreach (var qProductOrderBomInfo in qProductOrderBomInfos)
            {
                ///接口单车物料清单临时集合
                List <SapProductOrderBomInfo> orderBomInfos = productOrderBomInfos.Where(d =>
                                                                                         d.Fmatnr == qProductOrderBomInfo.Key.Fmatnr &&
                                                                                         d.Dwerk == qProductOrderBomInfo.Key.Dwerk &&
                                                                                         d.Aufnr == qProductOrderBomInfo.Key.Aufnr &&
                                                                                         d.Verid == qProductOrderBomInfo.Key.Verid &&
                                                                                         d.Zzdd == qProductOrderBomInfo.Key.Zzdd &&
                                                                                         d.OnlineDate == qProductOrderBomInfo.Key.OnlineDate &&
                                                                                         d.OfflineDate == qProductOrderBomInfo.Key.OfflineDate).ToList();
                List <BFDASapProductOrderBomMatnrdInfo> sapProductOrderBomMatnrdInfos = new List <BFDASapProductOrderBomMatnrdInfo>();
                foreach (var orderBomInfo in orderBomInfos)
                {
                    sapProductOrderBomMatnrdInfos.Add(ConversionToCentreDetailInfo(orderBomInfo));
                }
                BFDASapProductOrderBomMatnrsInfo matnrsInfo = new BFDASapProductOrderBomMatnrsInfo();
                matnrsInfo.MatnrsAll = sapProductOrderBomMatnrdInfos;
                string matnrs = new XmlWrapper().ObjectToXmlByEncoding(matnrsInfo, Encoding.UTF8, false);
                matnrs = matnrs.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");
                matnrs = matnrs.Replace("\r\n", "").Trim();
                matnrs = matnrs.Replace(" ", "").Trim();

                ///
                SapProductOrderBomInfo info = new SapProductOrderBomInfo();
                info.Fmatnr      = qProductOrderBomInfo.Key.Fmatnr;
                info.Dwerk       = qProductOrderBomInfo.Key.Dwerk;
                info.Aufnr       = qProductOrderBomInfo.Key.Aufnr;
                info.Verid       = qProductOrderBomInfo.Key.Verid;
                info.Zzdd        = qProductOrderBomInfo.Key.Zzdd;
                info.OnlineDate  = qProductOrderBomInfo.Key.OnlineDate;
                info.OfflineDate = qProductOrderBomInfo.Key.OfflineDate;
                info.Matnrs      = matnrs;
                list.Add(info);
            }
            return(list);
        }
예제 #2
0
        /// <summary>
        /// 发送
        /// </summary>
        /// <param name="logFid"></param>
        /// <param name="interfaceConfigInfo"></param>
        /// <param name="errorCode"></param>
        /// <param name="errorMsg"></param>
        /// <param name="msgContent"></param>
        /// <returns></returns>
        public static ExecuteResultConstants Send(Guid logFid, InterfaceConfigInfo interfaceConfigInfo, ref string errorCode, ref string errorMsg, out string msgContent)
        {
            ///
            msgContent = string.Empty;
            ///
            List <SrmVmiSupplierPartInfo> vmiSupplierParts = new SrmVmiSupplierPartBLL().GetList("" +
                                                                                                 "[LOG_FID] = N'" + logFid + "' and " +
                                                                                                 "[PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (vmiSupplierParts.Count == 0)
            {
                errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认
                return(ExecuteResultConstants.Exception);
            }
            ///转换发送内容
            List <BFDAVmiSupplierPartInfo> list = new List <BFDAVmiSupplierPartInfo>();

            foreach (var vmiSupplierPartInfo in vmiSupplierParts)
            {
                list.Add(GetSrmVmiSupplierPartInfo(vmiSupplierPartInfo));
            }
            ///准备把集合转成一个对象
            BFDASRMSendDataInfo <BFDAVmiSupplierPartInfo> sendDataInfo = new BFDASRMSendDataInfo <BFDAVmiSupplierPartInfo>();

            sendDataInfo.List = list;
            ///
            SupplierMaterialService_pttClient client = new SupplierMaterialService_pttClient();

            client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl);
            ///数据发送
            msgContent = new XmlWrapper().ObjectToXmlByEncoding(sendDataInfo, Encoding.UTF8, false);
            msgContent = msgContent.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");

            ///
            string result = client.SupplierMaterialService(msgContent, out errorCode, out errorMsg);

            Log.WriteLogToFile(logFlag, interfaceCode + "--Return:dataCnt:" + result + "Content:" + msgContent + "\r", AppDomain.CurrentDomain.BaseDirectory + @"\log\", DateTime.Now.ToString("yyyyMMddHH"));

            if (result == Convert.ToString((int)OutboundReturnStateConstants.FAILURE))
            {
                return(ExecuteResultConstants.Error);
            }
            return(ExecuteResultConstants.Success);
        }
예제 #3
0
        /// <summary>
        /// 发送
        /// </summary>
        /// <param name="logFid"></param>
        /// <param name="interfaceConfigInfo"></param>
        /// <param name="errorCode"></param>
        /// <param name="errorMsg"></param>
        /// <param name="msgContent"></param>
        /// <returns></returns>
        public static ExecuteResultConstants Send(Guid logFid, InterfaceConfigInfo interfaceConfigInfo, ref string errorCode, ref string errorMsg, out string msgContent)
        {
            ///
            msgContent = string.Empty;
            ///
            List <SrmJisPullOrderInfo> srmJisPullOrderInfos = new SrmJisPullOrderBLL().GetList("[LOG_FID] = N'" + logFid + "' and [PROCESS_FLAG] = " + (int)ProcessFlagConstants.Untreated + "", string.Empty);

            if (srmJisPullOrderInfos.Count == 0)
            {
                errorCode = "MC:0x00000212";///经检测,传递数据为空,请确认
                return(ExecuteResultConstants.Exception);
            }
            ///转换成BFDA集合
            List <BFDAJisPullOrderInfo> list = new List <BFDAJisPullOrderInfo>();

            foreach (var srmJisPullOrderInfo in srmJisPullOrderInfos)
            {
                list.Add(GetSrmJisPullOrderInfo(srmJisPullOrderInfo));
            }
            ///准备把集合转成一个对象
            BFDASRMSendDataInfo <BFDAJisPullOrderInfo> sendDataInfo = new BFDASRMSendDataInfo <BFDAJisPullOrderInfo>
            {
                List = list
            };

            ///
            msgContent = new XmlWrapper().ObjectToXmlByEncoding(sendDataInfo, Encoding.UTF8, false);
            msgContent = msgContent.Replace("<?xml version=\"1.0\" encoding=\"utf-8\"?>", "");
            ///
            JISPullService_pttClient client = new JISPullService_pttClient();

            client.Endpoint.Address = new EndpointAddress(interfaceConfigInfo.CallUrl);
            ///数据发送
            string result = client.JISPullService(msgContent, out errorCode, out errorMsg);

            if (result == Convert.ToString((int)OutboundReturnStateConstants.FAILURE))
            {
                return(ExecuteResultConstants.Error);
            }
            return(ExecuteResultConstants.Success);
        }