Example #1
0
        ///根据衣架号从MES中查
        public static searchHangerInfoResponse searchHangerInfo(string site, string hangerId)
        {
            searchHangerInfo  search  = new searchHangerInfo();
            hangerInfoRequest request = new hangerInfoRequest();

            request.site     = site;
            request.hangerId = hangerId;
            search.Request   = request;

            //认证
            string apiUsername = getAppConfig("apiUsername");
            string apiUserPwd  = getAppConfig("apiUserPwd");
            HangerBindServiceService service = new HangerBindServiceService();
            string url = getAppConfig("apiUrl");

            service.Url             = url;
            service.Credentials     = new System.Net.NetworkCredential(apiUsername, apiUserPwd);
            service.Timeout         = int.Parse(getAppConfig("Interface_Overtime")) * 1000;
            service.RequestEncoding = UTF8Encoding.UTF8;
            service.SoapVersion     = System.Web.Services.Protocols.SoapProtocolVersion.Soap11;
            service.PreAuthenticate = true;

            if (getAppConfig("runningMode") == "debug")
            {
                searchHangerInfoResponse response = new searchHangerInfoResponse();
                var returnValue = new hangerInfoResponse();
                returnValue.sfc               = "112122212_TST";
                returnValue.partId            = "112122212";
                returnValue.site              = "仓位_1";
                returnValue.statusDescription = "数据异常";
                response.@return              = returnValue;
                return(response);
            }
            else
            {
                try
                {
                    searchHangerInfoResponse response = service.searchHangerInfo(search);
                    return(response);
                }
                catch
                {
                    logger.Error($"web service can not get data: {site}-{hangerId}");
                    searchHangerInfoResponse response = new searchHangerInfoResponse();
                    var returnValue = new hangerInfoResponse();
                    returnValue.sfc               = "";
                    returnValue.partId            = "";
                    returnValue.site              = "";
                    returnValue.statusDescription = "数据异常";
                    response.@return              = returnValue;
                    return(response);
                }
            }
        }
Example #2
0
        public IList <MatchPair> get()
        {
            List <MatchPair>       result = new List <MatchPair>();
            List <BarCodeRelation> barCodeRelations;

            using (var hangdb = new SqlConnection(hang_db_string))
            {
                result = Utils.GetHangerMaster(hangdb, leftpart, rightpart);
            }

            if (result.Count > 0)
            {
                using (var bardb = new SqlConnection(barcode_db_string))
                {
                    List <string> hangerIds = new List <string>();
                    result.ForEach(i =>
                    {
                        if (i.ZH_hangid != "")
                        {
                            hangerIds.Add(i.ZH_hangid);
                        }
                        if (i.GM_hangid != "")
                        {
                            hangerIds.Add(i.GM_hangid);
                        }
                    });
                    barCodeRelations = Utils.GetProductTag(bardb, hangerIds);
                }

                using (var hanginfodb = new SqlConnection(barcode_db_string))
                {
                    result.ForEach(i => {
                        if (i.ZH_hangid == "")
                        {
                            string hangerId = Utils.GetHangInfoID(hanginfodb, i.classifiedinfo, leftpart);
                            searchHangerInfoResponse resp = Utils.searchHangerInfo(this.site, hangerId);
                            i.ZH_hangid = hangerId;
                            if (resp != null && resp.@return != null)
                            {
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }

                                if ([email protected]('_') > 0)
                                {
                                    i.ZH_hangid = [email protected];
                                }
                                else
                                {
                                    i.ZH_part = [email protected] + "_" + [email protected];
                                }
                                i.ZH_location = [email protected];
                                i.ZH_status   = [email protected];
                            }
                        }
                        else
                        {
                            i.ZH_part = Utils.FindProductTag(barCodeRelations, i.ZH_hangid) + "_" + leftpart;
                        }

                        i.wait = DateTime.Now - i.start;

                        if (i.GM_hangid == "")
                        {
                            string hangerId = Utils.GetHangInfoID(hanginfodb, i.classifiedinfo, this.rightpart);
                            searchHangerInfoResponse resp = Utils.searchHangerInfo(this.site, hangerId);

                            i.GM_hangid = hangerId;
                            if (resp != null && resp.@return != null)
                            {
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }
                                if ([email protected] == null)
                                {
                                    [email protected] = "";
                                }

                                if ([email protected]('_') > 0)
                                {
                                    i.GM_part = [email protected];
                                }
                                else
                                {
                                    i.GM_part = [email protected] + "_" + [email protected];
                                }
                                i.GM_location = [email protected];
                                i.GM_status   = [email protected];
                            }
                        }
                        else
                        {
                            i.GM_part = Utils.FindProductTag(barCodeRelations, i.GM_hangid) + "_" + this.rightpart;
                        }
                    });
                }
            }

            return(result);
        }