Exemple #1
0
        /// <summary>
        /// 设备请求条码
        /// </summary>
        public static RootObject BarCodeRequest(string M_WORKSTATION_SN, EnumQRCodeType qrcodeType, string CONTROL_TYPE, ref string jsonStr)
        {
            List <ContentDetail> CList = new List <ContentDetail>();
            ContentDetail        tail  = new ContentDetail();

            tail.M_FLAG = 11;
            // tail.M_WORKSTATION_SN = "Y00100101";
            tail.M_WORKSTATION_SN = M_WORKSTATION_SN;
            CList.Add(tail);
            //上传参数
            string strJson = WShelper.ReturnJsonData("OK", CONTROL_TYPE, CList);
            object objJson = strJson;

            object[] addParams = new object[] { objJson };
            if (SysCfgModel.MesOfflineMode == true)//离线模式将上报数据存储到数据库
            {
                RootObject rObj = new RootObject();
                DBAccess.Model.QRCodeModel qrCode = bllQrCode.RequireQrCode(qrcodeType.ToString());
                if (qrCode == null)
                {
                    ContentDetail offlienTail = new ContentDetail();
                    offlienTail.M_SN = "";
                    rObj.M_COMENT    = new List <ContentDetail>();
                    rObj.M_COMENT.Add(offlienTail);
                    rObj.CONTROL_TYPE = "";
                    rObj.RES          = "离线条码申请失败!";
                    return(rObj);
                }
                else
                {
                    ContentDetail offlienTail = new ContentDetail();
                    offlienTail.M_SN = qrCode.QRCode;
                    rObj.M_COMENT    = new List <ContentDetail>();
                    rObj.M_COMENT.Add(offlienTail);
                    rObj.CONTROL_TYPE = "";
                    rObj.RES          = "OK!离线条码申请成功:" + qrCode.QRCode;
                    qrCode.PintStatus = EnumQrCodeApplyStatus.已申请.ToString();
                    bllQrCode.Update(qrCode);
                    return(rObj);
                }
            }
            else
            {
                object     result = WShelper.InvokeWebService(url, "DxDataUploadJson", addParams);
                string     strRES = result.ToString();
                RootObject rObj   = new RootObject();
                rObj    = JsonConvert.DeserializeObject <RootObject>(strRES);
                jsonStr = strRES;
                return(rObj);
            }
        }
Exemple #2
0
        /// <summary>
        /// 从MES获取测试标准数据
        /// </summary>
        /// <param name="M_FLAG"></param>
        /// <param name="M_AREA"></param>
        /// <param name="M_ITEM_TYPE"></param>
        /// <returns></returns>
        public static RootObject GetTestStandardDataFromMES(int M_FLAG, string M_AREA, int M_ITEM_TYPE)
        {
            RootObject rObj = null;

            if (SysCfgModel.SimMode)
            {
                rObj     = new RootObject();
                rObj.RES = "NG,仿真模式不支持获取标准!";

                return(rObj);
            }
            if (SysCfgModel.MesOfflineMode == true)//只有在线模式才能申请标准
            {
                rObj     = new RootObject();
                rObj.RES = "NG,离线模式不支持获取标准";

                return(rObj);
            }
            List <ContentDetail> CList = new List <ContentDetail>();
            ContentDetail        tail  = new ContentDetail();

            tail.M_FLAG      = M_FLAG;
            tail.M_AREA      = M_AREA;
            tail.M_ITEM_TYPE = M_ITEM_TYPE;
            CList.Add(tail);
            string CONTROL_TYPE = "";
            //上传参数
            string strJson = WShelper.ReturnJsonData("OK", CONTROL_TYPE, CList);
            object objJson = strJson;

            object[] addParams = new object[] { objJson };

            object result = WShelper.InvokeWebService(url, "DxDataUploadJson", addParams);
            string strRES = result.ToString();

            rObj = new RootObject();
            rObj = JsonConvert.DeserializeObject <RootObject>(strRES);

            return(rObj);
        }
Exemple #3
0
        /// <summary>
        /// 过程参数上传
        /// </summary>
        /// <param name="M_FLAG"></param>
        /// <param name="M_DEVICE_SN"></param>
        /// <param name="M_WORKSTATION_SN"></param>
        /// <param name="M_SN"></param>
        /// <param name="M_UNION_SN"></param>
        /// <param name="M_CONTAINER_SN"></param>
        /// <param name="M_LEVEL"></param>
        /// <param name="M_ITEMVALUE"></param>
        /// <returns></returns>
        public static RootObject ProcParamUpload(string M_AREA, string M_DEVICE_SN, string M_WORKSTATION_SN, string M_SN, string M_UNION_SN, string M_CONTAINER_SN, string M_LEVEL, string M_ITEMVALUE, ref string strJson, string CONTROL_TYPE)
        {
            RootObject rObj = null;

            if (SysCfgModel.SimMode)
            {
                rObj     = new RootObject();
                rObj.RES = "OK";

                return(rObj);
            }
            List <ContentDetail> CList = new List <ContentDetail>();
            ContentDetail        tail  = new ContentDetail();

            tail.M_FLAG           = 6;
            tail.M_AREA           = M_AREA;
            tail.M_SN             = M_SN;
            tail.M_DEVICE_SN      = M_DEVICE_SN;
            tail.M_WORKSTATION_SN = M_WORKSTATION_SN;
            tail.M_UNION_SN       = M_UNION_SN;
            tail.M_CONTAINER_SN   = M_CONTAINER_SN;
            tail.M_LEVEL          = M_LEVEL;
            tail.M_ITEMVALUE      = M_ITEMVALUE;
            tail.CONTROL_TYPE     = CONTROL_TYPE;
            CList.Add(tail);
            //上传参数
            strJson = WShelper.ReturnJsonData("OK", CONTROL_TYPE, CList);
            object objJson = strJson;

            object[] addParams = new object[] { objJson };
            if (SysCfgModel.MesOfflineMode == true)//离线模式将上报数据存储到数据库
            {
                FTDataAccess.Model.OfflineDataModel offlineModel = new FTDataAccess.Model.OfflineDataModel();
                offlineModel.OfflineDataID  = Guid.NewGuid().ToString();
                offlineModel.IsUpLoad       = EnumUploadStatus.待上传.ToString();
                offlineModel.DataType       = EnumUpLoadDataType.过程数据.ToString();
                offlineModel.WorkStationID  = M_WORKSTATION_SN;
                offlineModel.CreateTime     = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                offlineModel.UploadJsonData = strJson;
                bllOfflineData.Add(offlineModel);
                rObj     = new RootObject();
                rObj.RES = "OK";
                return(rObj);
            }
            else
            {
                object result = WShelper.InvokeWebService(url, "DxDataUploadJson", addParams);
                string strRES = result.ToString();
                rObj = new RootObject();
                rObj = JsonConvert.DeserializeObject <RootObject>(strRES);
                FTDataAccess.Model.OfflineDataModel offlineModel = new FTDataAccess.Model.OfflineDataModel();
                offlineModel.OfflineDataID  = Guid.NewGuid().ToString();
                offlineModel.IsUpLoad       = EnumUploadStatus.已上传.ToString();
                offlineModel.DataType       = EnumUpLoadDataType.过程数据.ToString();
                offlineModel.WorkStationID  = M_WORKSTATION_SN;
                offlineModel.CreateTime     = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                offlineModel.UploadJsonData = strJson;
                bllOfflineData.Add(offlineModel);

                return(rObj);
            }
        }