/// <summary> /// 添加一条iqckp记录 /// </summary> /// <param name="iqcKp"></param> public void AddIqcKp(IqcKpDef iqcKp) { try { defectRepository.AddIqcKp(iqcKp); } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// tp="SQE"或者tp="PE"时的处理情况 /// </summary> /// <param name="Tp"></param> /// <param name="CTNO"></param> /// <param name="Defect"></param> /// <param name="Cause"></param> protected void CheckAndSaveIqcKpSQE(string Tp, string CTNO, string Defect, string Cause) { IList<IqcKpDef> lstIqcKp = new List<IqcKpDef>(); IList<IqcKpDef> lstIqcKpPE = new List<IqcKpDef>(); //第一次查询SQE lstIqcKp = SQEDefectReport.GetIqcKpByTypeCtLabelAndDefect("MP", CTNO, Defect); lstIqcKpPE = SQEDefectReport.GetIqcKpByTypeCtLabelAndDefect("PE", CTNO, Defect, Cause); IqcKpDef iqckp = new IqcKpDef(); iqckp.CtLabel = CTNO; iqckp.Cause = this.drpCause.InnerDropDownList.SelectedValue; iqckp.Defect = Defect; iqckp.Model = this.dModelPartNo.Text; iqckp.Obligation = this.drpObligation.InnerDropDownList.SelectedValue; iqckp.Remark = this.dRemark.Text; iqckp.Result = this.dResult.Text; iqckp.Editor = this.hiddenUserName.Value; //iqckp.Location = ""; //add location iqckp.Location=this.drpMajorPart.InnerDropDownList.SelectedValue + " " + this.drpCommponent.InnerDropDownList.SelectedValue; iqckp.Udt = DateTime.Now; //tp="SQE"的情况 if (Tp == "SQE") { if (lstIqcKp != null && lstIqcKp.Count > 0) { //第二次查询SQE IList<IqcKpDef> lstIqcKp1 = new List<IqcKpDef>(); lstIqcKp1 = SQEDefectReport.GetIqcKpByTypeCtLabelAndDefect("IQC", CTNO, Defect, Cause); iqckp.Tp = "IQC"; if (lstIqcKp1 == null) { //创建一条新的数据 iqckp.Cdt = DateTime.Now; SQEDefectReport.AddIqcKp(iqckp); this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();DealHideWait();alert('" + pmtMessage3.Trim() + "');", true); return; } else { //修改已经存在的数据 SQEDefectReport.UpdateIqcKp(iqckp, "IQC", CTNO, Defect); this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();DealHideWait();alert('" + pmtMessage4.Trim() + "');", true); } } else { //MP未退SQE,不能Save this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();DealHideWait();alert('" + pmtMessage5.Trim() + "');", true); return; } } if (Tp == "PE") { //TP="PE"的情况 if (lstIqcKpPE == null) { //添加一条TP="PE"的情况 iqckp.Tp = "PE"; iqckp.Cdt = DateTime.Now; SQEDefectReport.AddIqcKp(iqckp); this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();DealHideWait();alert('" + pmtMessage3.Trim() + "');", true); } else { //修改一条Tp="PE"的情况 iqckp.Tp = "PE"; SQEDefectReport.UpdateIqcKp(iqckp, Tp, iqckp.CtLabel, iqckp.Defect); this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();alert('" + pmtMessage4.Trim() + "');DealHideWait();", true); } } }
/// <summary> /// tp="MP->SQE"的处理情况 /// </summary> /// <param name="Tp"></param> /// <param name="CTNO"></param> /// <param name="Defect"></param> protected void CheckAndSaveIqcKp(string Tp, string CTNO, string Defect) { IList<IqcKpDef> lstIqcKp = new List<IqcKpDef>(); lstIqcKp = SQEDefectReport.GetIqcKpByTypeCtLabelAndDefect(Tp, CTNO, Defect); string ctNo = this.dCTNO.Text; string defect = this.drpDefect.InnerDropDownList.SelectedValue; IqcKpDef iqckp = new IqcKpDef(); iqckp.CtLabel = this.dCTNO.Text; iqckp.Model = this.dModelPartNo.Text; //add location //iqckp.Location = this.drpMajorPart.InnerDropDownList.SelectedValue + " " + this.drpCommponent.InnerDropDownList.SelectedValue; iqckp.Editor = this.hiddenUserName.Value; if (lstIqcKp == null || lstIqcKp.Count <= 0) { iqckp.Udt = DateTime.Now; iqckp.Defect = defect; iqckp.Cdt = DateTime.Now; iqckp.Tp = Tp; if (Tp == "MP") { iqckp.Obligation = ""; iqckp.Cause = ""; iqckp.Location = ""; iqckp.Result = ""; iqckp.Remark = ""; iqckp.Location = ""; } //创建一条新数据 SQEDefectReport.AddIqcKp(iqckp); this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();alert('" + pmtMessage3.Trim() + "');DealHideWait();", true); } else { //不存在此数据时候不做处理 this.updatePanel1.Update(); ScriptManager.RegisterStartupScript(this.UpdatePanelAll, typeof(System.Object), "saveUpdate", "resetTableHeight();DealHideWait();", true); } }
/// <summary> /// 根据tp,ctno和defect更细一条iqckp记录 /// </summary> /// <param name="iqcKp"></param> /// <param name="tp"></param> /// <param name="ctLabel"></param> /// <param name="defect"></param> public void UpdateIqcKp(IqcKpDef iqcKp, string tp, string ctLabel, string defect) { IqcKpDef condition = new IqcKpDef(); //IList<IqcKpDef> lstSetIqckp = defectRepository.GetIqcKpByTypeCtLabelAndDefect(tp, ctLabel, defect); IqcKpDef iqcKpSet = new IqcKpDef(); //condition = lstSetIqckp.First(); iqcKpSet.Cause = iqcKp.Cause; iqcKpSet.Editor = iqcKp.Editor; iqcKpSet.Location = iqcKp.Location; iqcKpSet.Obligation = iqcKp.Obligation; iqcKpSet.Model = iqcKp.Model; iqcKpSet.Remark = iqcKp.Remark; iqcKpSet.Result = iqcKp.Result; iqcKpSet.Udt = iqcKp.Udt; condition.Tp = tp; condition.CtLabel = ctLabel; condition.Defect = defect; try { defectRepository.UpdateIqcKp(iqcKpSet, condition); } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }