private string getPrintContentCode(string OQCCheckId, string YBBQ) { OQCCheckHelper ipqc = new OQCCheckHelper(); DataTable dt = ipqc.GetCheckInfo(OQCCheckId); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("{\"result\":0,\"msg\":\"获取成功\",\"data\":"); DataRow dr = dt.Rows[0]; PrintCodeConvert pc = new PrintCodeConvert(); string Msg = pc.GetPrintOQCPackCodeConvertStr( Convert.ToString(dr["BillNo"]), Convert.ToString(dr["CustomerName"]), Convert.ToString(dr["ProductShortName"]), Convert.ToString(dr["ProductDescription"]), Convert.ToString(dr["YBBQ"]), Convert.ToInt32(dr["Qty"]) ); return("{\"result\":1,\"msg\":\"" + Msg + "\"}"); } else { return("{\"result\":-1,\"msg\":\"获取失败\"}"); } }
/// <summary> /// 获取待完成首检数据 /// </summary> /// <returns></returns> private string getOQCCheckTodo(string keyWork) { int pageCount, recCount; OQCCheckHelper ipqc = new OQCCheckHelper(); StringBuilder sb = new StringBuilder(); result.RetStr = ipqc.GetOQCCheckTodo(keyWork, "", 20, curPage, out pageCount, out recCount, out outDataSet); if (result.Code == 0) { sb.Append("{\"result\":0,\"msg\":\"获取成功\",\"data\":["); for (int i = 0; i < outDataSet.Tables[0].Rows.Count; i++) { DataRow dr = outDataSet.Tables[0].Rows[i]; string json = "{" + String.Format("\"FBillNo\":\"{0}\",\"ProductId\":\"{1}\",\"Qty\":\"{2}\"," + "\"SourceBillNo\":\"{3}\",\"ProductDescription\":\"{4}\",\"ProductShortName\":\"{5}\",\"CustomerName\":\"{6}\",\"OQCCheckId\":\"{7}\",\"QCResult\":\"{8}\",\"SEOutStockEntryId\":\"{9}\"", dr["FBillNo"], dr["ProductId"], dr["Qty"], dr["SourceBillNo"], dr["ProductDescription"], dr["ProductShortName"], dr["CustomerName"], dr["OQCCheckId"], dr["QCResult"], dr["SEOutStockEntryId"]) + "}"; sb.Append(json); if (i != outDataSet.Tables[0].Rows.Count - 1) { sb.Append(","); } } sb.Append("]}"); } return(sb.ToString()); }
/// <summary> /// 根据工序ID获取信息 /// </summary> /// <param name="OQCCheckId"></param> /// <returns></returns> private string getCheckInfo(string OQCCheckId) { //if (!string.IsNullOrEmpty(ScanLotSN)) // if (OQCCheckId != ScanLotSN) return "{\"result\":-1,\"msg\":\"扫描信息与" + OQCCheckId + "不匹配\"}"; //根据用户去 OQCCheckHelper ipqc = new OQCCheckHelper(); DataTable dt = ipqc.GetCheckInfo(OQCCheckId); if (dt.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); sb.Append("{\"result\":0,\"msg\":\"获取成功\",\"data\":"); DataRow dr = dt.Rows[0]; string XMLData = Convert.ToString(dr["XMLData"]); if (!string.IsNullOrEmpty(XMLData)) { string jsonData = CommHelper.XMLToJson(XMLData); JObject o = JObject.Parse(jsonData); JToken Token = o["IQCdata"]; Token["Describe"].Parent.AddAfterSelf(new JProperty("FBillNo", Convert.ToString(dr["FBillNo"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("ProductId", Convert.ToString(dr["ProductId"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("Qty", Convert.ToString(dr["Qty"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("OQCReportId", Convert.ToString(dr["OQCReportId"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("SourceBillNo", Convert.ToString(dr["SourceBillNo"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("ProductDescription", Convert.ToString(dr["ProductDescription"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("ProductShortName", Convert.ToString(dr["ProductShortName"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("CustomerName", Convert.ToString(dr["CustomerName"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("OQCCheckId", Convert.ToString(dr["OQCCheckId"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("QCResult", Convert.ToString(dr["QCResult"]))); Token["Describe"].Parent.AddAfterSelf(new JProperty("SEOutStockEntryId", Convert.ToString(dr["SEOutStockEntryId"]))); sb.Append(CommHelper.JsonTOStr(Token)); sb.Append("}"); return(sb.ToString()); } else { string json = "{" + String.Format("\"FBillNo\":\"{0}\",\"ProductId\":\"{1}\",\"Qty\":\"{2}\"," + "\"SourceBillNo\":\"{3}\",\"ProductDescription\":\"{4}\",\"ProductShortName\":\"{5}\",\"CustomerName\":\"{6}\",\"OQCCheckId\":\"{7}\",\"QCResult\":\"{8}\",\"SEOutStockEntryId\":\"{9}\"", dr["FBillNo"], dr["ProductId"], dr["Qty"], dr["SourceBillNo"], dr["ProductDescription"], dr["ProductShortName"], dr["CustomerName"], dr["OQCCheckId"], dr["QCResult"], dr["SEOutStockEntryId"]) + "}"; sb.Append(json); sb.Append("}"); return(sb.ToString()); } } else { return("{\"result\":-1,\"msg\":\"扫描信息不存在\"}"); } }
/// <summary> /// 打印样本标签 /// </summary> /// <param name="OQCCheckId"></param> /// <returns></returns> private string printLabel(string SEOutStockEntryId) { OQCCheckHelper oqc = new OQCCheckHelper(); string msg = ""; if (oqc.PrintLabel(SEOutStockEntryId, out msg)) { return("{\"result\":1,\"msg\":\"" + msg + "\"}"); } else { return("{\"result\":-1,\"msg\":\"打印样本标签失败:" + msg + "\"}"); } }
/// <summary> /// 保存临时数据 /// </summary> /// <param name="OQCCheckId"></param> /// <returns></returns> private string checkResultTempSubmit(string OQCCheckId) { OQCCheckHelper ipqc = new OQCCheckHelper(); string XMLData = CommHelper.ConvertXmlToString(Convert.ToString(Request.Form["OQCData"])).ToString(); OQCCheckModel model = new OQCCheckModel(); model.Describe = Describe; model.OQCCheckId = OQCCheckId; model.XMLData = XMLData; string msg = ""; if (ipqc.SaveTempData(model, out msg)) { return("{\"result\":1,\"msg\":\"" + msg + "\"}"); } else { return("{\"result\":-1,\"msg\":\"保存数据失败:" + msg + "\"}"); } }
/// <summary> /// 提交数据 /// </summary> /// <param name="OQCCheckId"></param> /// <returns></returns> private string checkResultSubmit(string OQCCheckId) { OQCCheckHelper ipqc = new OQCCheckHelper(); string XMLData = CommHelper.ConvertXmlToString(Convert.ToString(Request.Form["OQCData"])).ToString(); string Describe = Convert.ToString(Request.Form["Describe"]); string QCResult = Convert.ToString(Request.Form["QCResult"]); OQCCheckModel model = new OQCCheckModel(); model.Describe = Describe; model.QCResult = int.Parse(QCResult); model.OQCCheckId = OQCCheckId; model.XMLData = XMLData; string msg = ""; if (ipqc.CheckResultSubmit(model, out msg)) { return("{\"result\":0,\"msg\":\"" + msg + "\"}"); } else { return("{\"result\":-1,\"msg\":\"数据提交失败:" + msg + "\"}"); } }