/// <summary> /// TM自动初步总检 /// </summary> /// <param name="dr"></param> private void autoChuBu(DataRow dr) { string ordernum = dr["ordernum"].ToString(); string resultcomment = dr["resultcomment"].ToString(); //step one :检测结果是否有异常,无则进行自动初步总检,有则跳过并标记 if (os.CheckTestResultIsException(ordernum)) { //对此类订单做标记,下次扫描就不查询 Hashtable htStatus = new Hashtable(); htStatus.Add("status", 1); htStatus.Add("ordernum", ordernum); os.SetAutoFirstCheckStatus(htStatus); return; } //step two :根据是否已有结果评价,如果有则直接进入下一步,否则先从正常结果描述评价中随机选一个保存到结果评价表 if (string.IsNullOrEmpty(resultcomment)) { Random rand = new Random(); int k = rand.Next(1, 11); DataTable dtComment = os.GetRandResultComment(k); if (dtComment.Rows.Count > 0) { resultcomment = dtComment.Rows[0]["resultcomment"].ToString(); } Orderresultcomment orc = new Orderresultcomment(); orc.Engresultcomment = orc.Engresultsuggestion = string.Empty; orc.Resultcomment = resultcomment; orc.Resultsuggestion = string.Empty; orc.Ordernum = ordernum; OrderresultcommentService orcs = new OrderresultcommentService(); if (orcs.SelectOrderresultcomment(orc.Ordernum) == null) { orcs.InsertOrderresultcomment(orc); } else { orcs.UpdateOrderresultcomment(orc); } } //step three :初步总检 Hashtable ht = new Hashtable(); ht.Add("ordernum", ordernum); ht.Add("oldstatus", (int)ParamStatus.OrdersStatus.WaitCheck); ht.Add("status", (int)ParamStatus.OrdersStatus.FirstCheck); ht.Add("authorizedbyid", userid); if (os.EditStatusByOldStatus(ht)) { //step four :初步总检成功后记录操作日志 Hashtable htScan = new Hashtable(); htScan.Add("isScan", true); htScan.Add("EnterByID", userid); htScan.Add("EnterBy", username); os.AddOperationLog(ordernum, null, "初步总检", "对[" + ordernum + "]执行自动初步总检", "修改留痕", "", htScan); } }
/// <summary> /// 加载总体评价 /// </summary> /// <param name="rowindex"></param> void InitgdOrderResultComment(string ordernum) { OrderresultcommentService orcs = new OrderresultcommentService(); Orderresultcomment orc = orcs.SelectOrderresultcomment(ordernum); if (orc != null) { tbxComment.Text = orc.Resultcomment; tbxSuggestion.Text = orc.Resultsuggestion; } else { tbxComment.Text = tbxSuggestion.Text = string.Empty; } }
//保存总体评价 protected void btnSave_Click(object sender, EventArgs e) { if (tbxordernum.Text.Trim() == string.Empty || gdOrders.SelectedRowIndexArray.Length == 0) { MessageBoxShow("请先选择一条记录!"); return; } string suggestion = tbxSuggestion.Text.Trim(); string comment = tbxComment.Text.Trim(); Orderresultcomment orc = new Orderresultcomment(); orc.Engresultcomment = orc.Engresultsuggestion = string.Empty; orc.Resultcomment = comment; orc.Resultsuggestion = suggestion; orc.Ordernum = tbxordernum.Text; int[] intstr = gdOrders.SelectedRowIndexArray; OrderresultcommentService orcs = new OrderresultcommentService(); try { if (orcs.SelectOrderresultcomment(orc.Ordernum) == null) { orcs.InsertOrderresultcomment(orc); } else { orcs.UpdateOrderresultcomment(orc); } MessageBoxShow("保存成功!"); } catch (Exception ex) { MessageBoxShow("保存失败:" + ex.Message); } }