Ejemplo n.º 1
0
        private async Task <Tuple <bool, RightMaterialServiceErrorCodeEnum> > RightMaterialFlow()
        {
            bool ret = false;

            bool S_HouseRequestFCS = false;

            ret = ControlDevice.GetHouseRequestFCS(ref S_HouseRequestFCS);
            if (ret != true)
            {
                return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(false, RightMaterialServiceErrorCodeEnum.GETREQ));
            }

            if (S_HouseRequestFCS == true)
            {
                Temp_S_House_RequestFCS_Last = S_HouseRequestFCS;

                //防错处理
                ret = CheckOnBegin();
                if (ret != true)
                {
                    return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(false, RightMaterialServiceErrorCodeEnum.CHECKONBEGIN));
                }

                //料库通讯
                bool S_House_InOut = false;
                var  ret_inout     = ControlDevice.GetHouseInOut(ref S_House_InOut);
                if (ret_inout == false)
                {
                    return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(ret_inout, RightMaterialServiceErrorCodeEnum.INOUT));
                }



                if (S_House_InOut == true)
                {
                    var ret_out = await RightMaterialOutFlow();

                    if (ret_out.Item1 == false)
                    {
                        return(ret_out);
                    }
                }
                else
                {
                    var ret_in = await RightMaterialInFlow();

                    if (ret_in.Item1 == false)
                    {
                        return(ret_in);
                    }
                }
            }
            else
            {
                Temp_S_House_RequestFCS_Last = S_HouseRequestFCS;
            }


            return(new Tuple <bool, RightMaterialServiceErrorCodeEnum>(true, RightMaterialServiceErrorCodeEnum.NORMAL));
        }