Ejemplo n.º 1
0
        public bool CheckSerialNumber(string sn)
        {
            if (sn == "")
            {
                return(SetMsgAndReturn(EnumMessage.SnNotFound, new List <string>()
                {
                    "Serial Number"
                }, false));
            }

            var snVmList = GetWsObj.GetSn(sn);
            var snVm     = snVmList.Any() ? snVmList.First() : null;

            if (ShopOrder != null && snVm == null)
            {
                return(RegisterSnValidation(sn));                                    // register station
            }
            if (snVm == null)
            {
                return(SetMsgAndReturn(EnumMessage.SnNotFound, new List <string>()
                {
                    sn
                }, false));
            }
            if (!snVm.wip)
            {
                return(SetMsgAndReturn(EnumMessage.SnNotInWip, new List <string>()
                {
                    sn
                }, false));
            }

            SnDetail = GetWsObj.GetJsonObjectUrl <SnDetailVm>(snVm.url);
            if (SnDetail == null)
            {
                return(SetMsgAndReturn(EnumMessage.SnDetailNotFound, new List <string>()
                {
                    sn
                }, false));
            }
            if (!GetRouting())
            {
                return(SetMsgAndReturn(EnumMessage.RouteNotFound, new List <string>()
                {
                    SnDetail.number
                }, false));
            }

            if (!CheckRouting())
            {
                return(SetMsgAndReturn(EnumMessage.RouteNotFound, new List <string> {
                    SnDetail.number
                }, false));
            }
            if (UnitSn != sn)
            {
                sn = UnitSn;               // this supports when flex overwrite txtsn
            }
            return(SetMsgAndReturn(EnumMessage.UnitIsReady, new List <string>()
            {
                SnDetail.number
            }, true));
        }