Beispiel #1
0
        public static int  SendMaterialPull(string partno, string operatornum, string stncode)
        {
            if (String.IsNullOrEmpty(operatornum))
            {
                operatornum = "无操作员";
            }
            string        jsonstr  = "[{ \"prodLineCode\":\"" + ConfigHelper.GetConfigValue("LineCode") + "\",\"stationCode\":\"" + stncode + "\",\"componentPartNo\":\"" + partno + "\",\"userNo\":\"" + operatornum + "\",\"time\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\"}]";
            IRestResponse response = SendDataToMES(jsonstr);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                SaveMessagaBLL bll = new SaveMessagaBLL();
                bll.WriteMessage("发送物料拉动请求时,MES服务器未能正确响应:" + response.StatusCode, stncode, 0);
                LogHelper.Write("发送物料拉动请求时,MES服务器未能正确响应:响应代码" + response.StatusCode, "system");
                return(50);
            }
            string    content   = response.Content;
            APIResult apiResult = new APIResult();

            apiResult = JsonConvert.DeserializeObject <APIResult>(content);
            if (apiResult.Result)
            {
                return(0);
            }
            else
            {
                SaveMessagaBLL bll = new SaveMessagaBLL();
                bll.WriteMessage("发送物料拉动请求时, MES服务器拒绝:" + apiResult.message, stncode, 0);
                LogHelper.Write("发送物料拉动请求时,MES服务器拒绝:响应代码" + apiResult.message, "system");
                return(40);
            }
        }
Beispiel #2
0
 public BingEvent()
 {
     messagaBLL = new SaveMessagaBLL();
 }
Beispiel #3
0
 public BingEvent(Socket socket)
 {
     messagaBLL   = new SaveMessagaBLL();
     SocketClient = socket;
 }