public bool AddFailure(Failure_Information item) { bool flag = false; if (instance.Add(item) > 0) { flag = true; } return flag; }
public void BatchProdStatChange(Failure_Information fi,string stat) { List<Sys_Map> mapsource = new BLL.Bll_Sys_Map().GetListByCode(string.Format("AND Map_module='ProdStatSource' AND Map_Source='NormalUse'")); var relations=GetRelation(fi.FInfo_Code); foreach (var d in relations) { d.FR_Stat = stat; //如果符合扭转为正常状态的 if (mapsource.Exists(o => o.Map_Object1 == d.FR_Stat)) { //零件产品状态更改 Inv_Information inv = invInstance.GetInvByPlanCode(d.FR_PlanCode); inv.IInfor_ProdStat = QX.Common.C_Class.OperationTypeEnum.ProdStatEnum.Normal.ToString(); invInstance.Update(inv); } UpdateFR(d); } }
public int AddFailureWithReturn(Failure_Information item) { //bool flag = false; var obj = instance.AddWithReturn(item); return TypeConverter.ObjectToInt(obj); }
public bool UpdateFailure(Failure_Information item) { bool flag = false; if (instance.Update(item) > 0) { flag = true; } return flag; }
public void ResetProdStat(Failure_Information finfo) { finfo.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString(); var model = auditInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.FailureAudit_F001.ToString()); if (model != null) { finfo.AuditCurAudit = model.VT_VerifyNode_Code; } var re1 = UpdateFailure(finfo); }
public bool InsertNewFailure(Failure_Information item) { bool flag = false; item.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString(); var model = auditInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.FailureAudit_F001.ToString()); if (model != null) { item.AuditCurAudit = model.VT_VerifyNode_Code; } if (instance.Add(item) > 0) { flag = true; } return flag; }
/// <summary> /// '获取实体 /// </summary> /// <param name="condition"></param> /// <returns></returns> public Failure_Information GetModel(string condition) { List<Failure_Information> list = instance.GetListByWhere(condition); Failure_Information model = new Failure_Information(); if (list != null && list.Count > 0) { model = list[0]; } return model; }
/// <summary> /// 设置不合格单据状态 /// </summary> /// <param name="finfo"></param> public Prod_Roads CheckProdStat(Failure_Information finfo) { //bool flag = false; Prod_Roads pr = new Prod_Roads(); string stat = finfo.FInfo_Stat; //如果检验合格,则更新库存状态和工序节点 if (stat == QX.Common.C_Class.OperationTypeEnum.ProdStatEnum.Normal.ToString() || stat == "MoreUse") { finfo.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.LastAudit.ToString(); //更新单据状态 var re1 = UpdateFailure(finfo); //库存 var model = invInstance.GetInvByProdCode(finfo.FInfo_CmdCode, finfo.FInfo_ProdNo); model.IInfor_ProdStat = OperationTypeEnum.ProdStatEnum.Normal.ToString(); var re2 = invInstance.Update(model); //更新工序节点 pr = prInstance.GetModel(string.Format(" AND PRoad_PlanCode='{0}' AND PRoad_NodeCode='{1}'", model.IInfor_PlanCode, finfo.FInfo_FindNode)); if (pr != null) { pr.PRoad_IsQuality = true; var re3 = prInstance.Update(pr); } } //如果已终审并为能处理合格,则产品进入次品处理 if (finfo.AuditStat == OperationTypeEnum.AudtiOperaTypeEnum.LastAudit.ToString() && stat == QX.Common.C_Class.OperationTypeEnum.ProdStatEnum.Defective.ToString()) { //库存 var model = invInstance.GetInvByProdCode(finfo.FInfo_CmdCode, finfo.FInfo_ProdNo); model.IInfor_ProdStat = OperationTypeEnum.ProdStatEnum.Defective.ToString(); var re2 = invInstance.Update(model); } return pr; }
public Failure_Information SetProdNodeChecked(bool isPass, Prod_Roads pr) { //bool flag = true; //进入不合格品流程 Failure_Information fi = null; if (isPass) { //设置生产状态 pr.PRoad_IsQuality = true; prInstance.Update(pr); //判断是否最后一个质检 List<Prod_Roads> list = prInstance.GetPlanRoadList(pr.PRoad_PlanCode); var checkedList = list.Where(o => o.PRoad_IsQuality); //如果已全部质检,则更新计划状态(库存表) if (checkedList.Count() == list.Count) { //判断是否存在终检 var model = invInstance.GetInvByProdCode(pr); model.IInfor_Stat = OperationTypeEnum.InvStatEnum.Entering.ToString(); //实际完工时间 model.IInfor_InTime = DateTime.Now; invInstance.Update(model); var temp = ppInstance.GetModelByKey(pr.PRoad_PlanCode); temp.PlanProd_FStat = OperationTypeEnum.ProdPlanStatEnum.Finish.ToString(); temp.PlanProd_FDate = DateTime.Now; ppInstance.UpdatePlan(temp); IsFinTask(temp.PlanProd_TaskCode); } } else { pr.PRoad_IsQuality = false; prInstance.Update(pr); //库存更新 var model = invInstance.GetInvByProdCode(pr); model.IInfor_ProdStat = OperationTypeEnum.ProdStatEnum.Unqualified.ToString(); invInstance.Update(model); //计划更新 var plan = ppInstance.GetModelByKey(pr.PRoad_PlanCode); fi = new Failure_Information(); fi.FInfo_Code = fiInstance.GenerateFailureInfor(); fi.FInfo_PartNo = plan.PlanProd_PartNo; fi.FInfo_PartName = plan.PlanProd_Code; fi.FInfo_CmdCode = plan.PlanProd_CmdCode; fi.FInfo_PartName = plan.PlanProd_PartName; fi.FInfo_Num = 1; fi.FInfo_ProdNo = plan.PlanProd_Code; fi.FInfo_FindNode = pr.PRoad_NodeCode; fi.FInfo_FindNodeName = pr.PRoad_NodeName; fi.FInfo_RespEntity = pr.PRoad_NodeDepName; fi.FInfo_Date = DateTime.Now; fi.FInfo_Stat = OperationTypeEnum.ProdStatEnum.Defective.ToString(); fi.FInfo_Owner = SessionConfig.UserCode; //状态设置 fi.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString(); Verify_TemplateConfig config = auInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.FailureAudit_F001.ToString()); if (config != null) { fi.AuditCurAudit = config.VT_VerifyNode_Code; } int id = fiInstance.AddFailureWithReturn(fi); fi.FInfo_ID = id; } return fi; }
/// <summary> /// 设置工艺节点检测状态 /// </summary> /// <param name="pr">当前工艺节点</param> /// <returns></returns> public bool SetProdNodeChecked(bool isPass, Prod_Roads pr, List<Road_TestRef> testlist) { bool flag = true; if (isPass) { //设置生产状态 pr.PRoad_IsQuality = true; prInstance.Update(pr); //foreach (Road_TestRef t in testlist) //{ // //添加检测记录 // Prod_TestRef test = new Prod_TestRef(); // //产品编码 // test.PTestRef_ProdCode =pr.PRoad_ProdCode; // test.PTestRef_Code = trInstance.GenerateTestRefCode(); // test.PTestRef_NodeCode = pr.PRoad_NodeCode; // test.PTestRef_NodeName = pr.PRoad_NodeName; // test.PTestRef_RefValue = t.TestRef_Value; // test.PTestRef_TestName = t.TestRef_Name; // test.PTestRef_TestNode = t.TestRef_Code; // test.PTestRef_High = t.TestRef_High; // test.PTestRef_Low = t.TestRef_Low; // test.PTestRef_IsLast = t.TestRef_IsLast; // test.PTestRef_Order = t.TestRef_Order; // var d=trInstance.AddTestRef(test); //} //判断是否最后一个质检 List<Prod_Roads> list = prInstance.GetPlanRoadList(pr.PRoad_PlanCode); var checkedList = list.Where(o => o.PRoad_IsQuality); //如果已全部质检,则更新计划状态(库存表) if (checkedList.Count() == list.Count) { //判断是否存在终检 var model = invInstance.GetInvByProdCode(pr); model.IInfor_Stat = OperationTypeEnum.InvStatEnum.Entering.ToString(); invInstance.Update(model); var model1 = ppInstance.GetModelByKey(pr.PRoad_PlanCode); model1.PlanProd_FDate = DateTime.Now; ppInstance.UpdatePlan(model1); var temp = ppInstance.GetModelByProdCode(pr.PRoad_ProdCode); IsFinTask(temp.PlanProd_TaskCode); ////获取所有计划列表 //var planList = ppInstance.GetFinPlanProdList(temp.PlanProd_TaskCode); //var task = ptInstance.GetTaskByCode(temp.PlanProd_TaskCode); //if (planList.Count == task.TaskDetail_Num) //{ // task.Task_Stat = OperationTypeEnum.ProdTaskStatEnum.Finish.ToString(); // ptInstance.UpdateProdTaskStat(task); //} } } else { pr.PRoad_IsQuality = false; prInstance.Update(pr); //库存更新 var model = invInstance.GetInvByProdCode(pr); model.IInfor_ProdStat = OperationTypeEnum.ProdStatEnum.Unqualified.ToString(); invInstance.Update(model); //foreach (Road_TestRef t in testlist) //{ // //添加检测记录 // Prod_TestRef test = new Prod_TestRef(); // test.PTestRef_Code = trInstance.GenerateTestRefCode(); // test.PTestRef_NodeCode = pr.PRoad_NodeCode; // test.PTestRef_NodeName = pr.PRoad_NodeName; // test.PTestRef_ProdCode = pr.PRoad_ProdCode; // test.PTestRef_RefValue = t.TestRef_Value; // test.PTestRef_TestName = t.TestRef_Name; // test.PTestRef_TestNode = t.TestRef_Code; // test.PTestRef_High = t.TestRef_High; // test.PTestRef_Low = t.TestRef_Low; // test.PTestRef_IsLast = t.TestRef_IsLast; // test.PTestRef_Order = t.TestRef_Order; // var d=trInstance.AddTestRef(test); //} var plan = ppInstance.GetModelByKey(pr.PRoad_PlanCode); //进入不合格品流程 Failure_Information fi = new Failure_Information(); fi.FInfo_Code = fiInstance.GenerateFailureInfor(); fi.FInfo_PartNo = plan.PlanProd_PartNo; fi.FInfo_PartName = plan.PlanProd_Code; fi.FInfo_CmdCode = plan.PlanProd_CmdCode; fi.FInfo_PartName = plan.PlanProd_PartName; fi.FInfo_Num = 1; fi.FInfo_ProdNo = plan.PlanProd_Code; fi.FInfo_FindNode = pr.PRoad_NodeCode; fi.FInfo_FindNodeName = pr.PRoad_NodeName; fi.FInfo_RespEntity = pr.PRoad_NodeDepName; fi.FInfo_Date = DateTime.Now; fi.FInfo_Stat = OperationTypeEnum.ProdStatEnum.Defective.ToString(); fi.FInfo_Owner = SessionConfig.UserCode; //状态设置 fi.AuditStat = OperationTypeEnum.AudtiOperaTypeEnum.Auditing.ToString(); Verify_TemplateConfig config = auInstance.GetVerifyTemplateFirstNode(OperationTypeEnum.AuditTemplateEnum.FailureAudit_F001.ToString()); if (config != null) { fi.AuditCurAudit = config.VT_VerifyNode_Code; } fiInstance.AddFailure(fi); } return flag; }