/// <summary> /// use to load the details for the selected part no /// </summary> private void SelectChangeComboPart() { try { drwBll.IsDefaultSubmitRequired = false; DDPCNECNModel = new DD_PCN(); ClearAllFields(DDPCNECNModel); DDPCNECNModel.PART_NO = (SelectedRow != null) ? SelectedRow["PART_NO"].ToString() : string.Empty; DDPCNECNModel.PART_DESC = (SelectedRow != null) ? SelectedRow["PART_DESC"].ToString() : string.Empty; if (ActionMode == OperationMode.AddNew) { GetCustomerDetails(); LostFocusPartNo(); } else { //System.Resources.ResourceManager myManager; //myManager = new System.Resources.ResourceManager(typeof(ProcessDesigner.Properties.Resources)); //string conStr = myManager.GetString("ConnectionString"); //DataAccessLayer dal = new DataAccessLayer(conStr); //DDPCNECNModel.SNO = dal.Get_Ecn_Pcn_Sel_Sno(DDPCNECNModel.PART_NO, _screenType); DDPCNECNModel.SNO = (SelectedRow != null) ? SelectedRow["SNO"].ToString().ToIntValue() : 0; GetECNMPSDetails(); } NotifyPropertyChanged("DDPCNECNModel"); } catch (Exception ex) { throw ex.LogException(); } }
public Int32 GetMaxSheetNo(string partNo, string screentype) { string requestedBy; requestedBy = (screentype == "MPS" ? "SFL" : "CUSTOMER"); try { List <DD_PCN> lstPCN = (from row in DB.DD_PCN where row.PART_NO.Trim() == partNo.Trim() && row.REQUSTED_BY.ToUpper().Trim() == requestedBy.ToUpper().Trim() select row).ToList <DD_PCN>(); List <DD_PCN> lstValue = new List <DD_PCN>(); foreach (DD_PCN row in lstPCN) { try { DD_PCN pcn = new DD_PCN(); pcn.SNO = getChangeNo(row.PRODUCT_CHANGE_NO); lstValue.Add(pcn); } catch (Exception ex) { } //lstValue.Add(getChangeNo(row.PRODUCT_CHANGE_NO)); } var maxProductChangeNo = lstValue.Max(x => x.SNO); maxProductChangeNo = maxProductChangeNo + 1; return(Convert.ToInt32(maxProductChangeNo)); } catch (Exception ex) { return(1); } }
/// <summary> /// /// </summary> private void ClearAll() { try { DDPCNECNModel = new DD_PCN(); ClearAllFields(DDPCNECNModel); PCNSheetNo = ""; SFLDrawIssueNo = ""; SFLDrawIssueNo1 = ""; PartNo = ""; RE_PPAP = false; NOT_RE_PPAP = true; NotifyPropertyChanged("PCNSheetNo"); NotifyPropertyChanged("SFLDrawIssueNo"); NotifyPropertyChanged("SFLDrawIssueNo1"); NotifyPropertyChanged("PartNo"); NotifyPropertyChanged("DDPCNECNModel"); NotifyPropertyChanged("RE_PPAP"); NotifyPropertyChanged("NOT_RE_PPAP"); NotifyPropertyChanged("ReadOnly"); NotifyPropertyChanged("AddEnable"); NotifyPropertyChanged("EditEnable"); NotifyPropertyChanged("SaveEnable"); NotifyPropertyChanged("HasDropDownVisibility"); PartNumberIsFocused = true; } catch (Exception ex) { throw ex.LogException(); } }
public void GetCustomerDetails(DD_PCN lstpcn) { try { var lstEntity = (from A in DB.PRD_CIREF from B in DB.DDCI_INFO from C in DB.DDCUST_MAST from E in DB.PRD_MAST where B.CI_REFERENCE == A.CI_REF && A.CURRENT_CIREF == true && B.CUST_CODE == C.CUST_CODE && A.PART_NO.Trim() == lstpcn.PART_NO.Trim() && E.PART_NO.Trim() == lstpcn.PART_NO.Trim() select new { A.CI_REF, B.CUST_DWG_NO, B.CUST_CODE, C.CUST_NAME, E.PART_DESC, E.PART_NO }).FirstOrDefault(); if (lstEntity != null) { // lstpcn.ECN_REFERENCE_NO = lstEntity.CI_REF; if (lstpcn.CUST_PART_NO.ToValueAsString() == "") { lstpcn.CUST_PART_NO = lstEntity.CUST_DWG_NO; } if (lstpcn.CUST_NAME.ToValueAsString() == "") { if (lstEntity.CUST_NAME.Length > 30) { lstpcn.CUST_NAME = lstEntity.CUST_NAME.Substring(0, 30); } else { lstpcn.CUST_NAME = lstEntity.CUST_NAME; } } } else { lstpcn.CUST_PART_NO = ""; lstpcn.CUST_NAME = ""; } } catch (System.Data.Linq.ChangeConflictException) { DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstpcn); DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges); } catch (Exception ex) { DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstpcn); ex.LogException(); } //SELECT A.CI_REF,B.cust_dwg_no,B.cust_code,C.cust_name,E.PART_DESC ,E.PART_NO FROM PRD_ciref A ,ddci_info B,ddcust_mast c ,PRD_MAST E //WHERE A.PART_NO = '" & ltbSflPartNo.text & "' AND E.PART_NO='" & ltbSflPartNo.text & "' AND B. ci_reference=A.CI_REF AND B.CUST_CODE=C.CUST_CODE }
public bool SaveECNMPSDetails(DD_PCN lstpcn, string partNo, string screentype, OperationMode actionMode) { DD_PCN lstEntity = new DD_PCN(); string requestedBy = ""; bool add = false; bool edit = false; bool submit = false; try { requestedBy = (screentype == "MPS" ? "SFL" : "CUSTOMER"); if (actionMode == OperationMode.Edit) { edit = true; lstEntity = (from row in DB.DD_PCN where row.SNO == lstpcn.SNO && row.REQUSTED_BY.ToUpper() == requestedBy.ToUpper() select row).FirstOrDefault(); if (lstEntity == null) { var maxId = DB.DD_PCN.Max(x => x.SNO); maxId = maxId + 1; lstEntity = new DD_PCN(); lstEntity.SNO = maxId; lstEntity.PART_NO = partNo.Trim(); lstEntity.REQUSTED_BY = requestedBy; edit = false; add = true; } } else { //var maxId = DB.DD_PCN.Max(x => x.SNO); var maxId = DB.DD_PCN.Max(x => x.SNO); maxId = maxId + 1; lstEntity = new DD_PCN(); lstEntity.SNO = maxId; lstEntity.PART_NO = lstpcn.PART_NO; lstEntity.REQUSTED_BY = requestedBy; edit = false; add = true; } lstEntity.ACTUAL_CHANGE_IMP = lstpcn.ACTUAL_CHANGE_IMP.ToValueAsString().Trim(); lstEntity.APPROVED_BY = lstpcn.APPROVED_BY.ToValueAsString().Trim(); lstEntity.CHANGE_EFFECTIVE = lstpcn.CHANGE_EFFECTIVE; lstEntity.COMPILED_BY = lstpcn.COMPILED_BY.ToValueAsString().Trim(); lstEntity.CONTROL_PLAN = lstpcn.CONTROL_PLAN; lstEntity.COST_DESC = lstpcn.COST_DESC.ToValueAsString().Trim(); lstEntity.CUST_NAME = lstpcn.CUST_NAME.ToValueAsString().Trim(); lstEntity.CUST_PART_NO = lstpcn.CUST_PART_NO.ToValueAsString().Trim(); lstEntity.DATE_OF_PCN = lstpcn.DATE_OF_PCN; lstEntity.DATE_OF_SIGN = lstpcn.DATE_OF_SIGN; lstEntity.DISPOSITION = lstpcn.DISPOSITION.ToValueAsString().Trim(); lstEntity.GAUGE_DWG = lstpcn.GAUGE_DWG; lstEntity.INFGG_INITIAL = lstpcn.INFGG_INITIAL.ToValueAsString().Trim(); lstEntity.INFGG_QTY = lstpcn.INFGG_QTY.ToValueAsString().Trim(); lstEntity.INHEAT_TREATMENT_INITIAL = lstpcn.INHEAT_TREATMENT_INITIAL.ToValueAsString().Trim(); lstEntity.INHEAT_TREATMENT_QTY = lstpcn.INHEAT_TREATMENT_QTY.ToValueAsString().Trim(); lstEntity.INWIP_INITIAL = lstpcn.INWIP_INITIAL.ToValueAsString().Trim(); lstEntity.INWIP_QTY = lstpcn.INWIP_QTY; lstEntity.MANUFACTURE_PROCESS = lstpcn.MANUFACTURE_PROCESS.ToValueAsString().Trim(); lstEntity.NATURE_OF_CHANGE = lstpcn.NATURE_OF_CHANGE.ToValueAsString().Trim(); lstEntity.OTHERS = lstpcn.OTHERS; lstEntity.PART_DESC = lstpcn.PART_DESC.ToValueAsString().Trim(); lstEntity.PFD = lstpcn.PFD; lstEntity.PFMEA = lstpcn.PFMEA; lstEntity.PRODUCT_CHANGE_NO = lstpcn.PRODUCT_CHANGE_NO.ToValueAsString().Trim(); lstEntity.PRODUCT_DWG = lstpcn.PRODUCT_DWG; lstEntity.RE_PPAP = lstpcn.RE_PPAP; lstEntity.RESON_FOR_CHANGE = lstpcn.RESON_FOR_CHANGE.ToValueAsString().Trim(); lstEntity.SEQUENCE_DWG = lstpcn.SEQUENCE_DWG; lstEntity.SFL_DRAW_ISSUE_DATE = lstpcn.SFL_DRAW_ISSUE_DATE; lstEntity.SFL_DRAW_ISSUEDATE1 = lstpcn.SFL_DRAW_ISSUEDATE1; lstEntity.SFL_DRAW_ISSUENO = lstpcn.SFL_DRAW_ISSUENO; lstEntity.SFL_DRAW_ISSUENO1 = lstpcn.SFL_DRAW_ISSUENO1; lstEntity.TOOL_DWG = lstpcn.TOOL_DWG; lstEntity.CUST_ISSUE_NO = lstpcn.CUST_ISSUE_NO; lstEntity.CUST_DWG_NO = lstpcn.CUST_DWG_NO.ToValueAsString().Trim(); lstEntity.CUST_DWG_NO_ISSUE = lstpcn.CUST_DWG_NO_ISSUE.ToValueAsString().Trim(); lstEntity.ROUTING_TAG = lstpcn.ROUTING_TAG; lstEntity.FINISH_CODE_SAP_DWG = lstpcn.FINISH_CODE_SAP_DWG; lstEntity.WORK_INSTRUCTION = lstpcn.WORK_INSTRUCTION; lstEntity.SAP_SEQ_DWG_ISSUE_NO_UPD = lstpcn.SAP_SEQ_DWG_ISSUE_NO_UPD; lstEntity.ALREADY_IN_EFFECT = lstpcn.ALREADY_IN_EFFECT; lstEntity.IMMEDIATE = lstpcn.IMMEDIATE; lstEntity.ALREADY_IN_EFFECT = lstpcn.ALREADY_IN_EFFECT; lstEntity.FROM_NEXT_HT_CYCLE = lstpcn.FROM_NEXT_HT_CYCLE; lstEntity.FROM_NEXT_FORGING = lstpcn.FROM_NEXT_FORGING; lstEntity.STOCK_AT_CODE = lstpcn.STOCK_AT_CODE.ToValueAsString().Trim(); lstEntity.STOCK_AT_DESCRIPTION = lstpcn.STOCK_AT_DESCRIPTION.ToValueAsString().Trim(); lstEntity.WARE_HOUSE_CODE = lstpcn.WARE_HOUSE_CODE.ToValueAsString().Trim(); lstEntity.LOGISTICS_DESCRIPTION = lstpcn.LOGISTICS_DESCRIPTION.ToValueAsString().Trim(); lstEntity.WARE_HOUSE_DESCRIPTION = lstpcn.WARE_HOUSE_DESCRIPTION.ToValueAsString().Trim(); lstEntity.WIP_HT_CODE = lstpcn.WIP_HT_CODE.ToValueAsString().Trim(); lstEntity.NEW_CODE = lstpcn.NEW_CODE.ToValueAsString().Trim(); lstEntity.NEW_DESCRIPTION = lstpcn.NEW_DESCRIPTION.ToValueAsString().Trim(); lstEntity.DATE_OF_IMPLEMENTATION = lstpcn.DATE_OF_IMPLEMENTATION; lstEntity.INVOICE_NO = lstpcn.INVOICE_NO.ToValueAsString().Trim(); lstEntity.INVOICE_DATE = lstpcn.INVOICE_DATE; lstEntity.ECN_REFERENCE_NO = lstpcn.ECN_REFERENCE_NO.ToValueAsString().Trim(); lstEntity.VERIFICATION = lstpcn.VERIFICATION.ToValueAsString().Trim(); lstEntity.VALIDATION = lstpcn.VALIDATION.ToValueAsString().Trim(); lstEntity.LOGISTICS_CODE = lstpcn.LOGISTICS_CODE; lstEntity.WIP_HT_DESCRIPTION = lstpcn.WIP_HT_DESCRIPTION; lstEntity.SIGNATURE_NAME = lstpcn.SIGNATURE_NAME; lstEntity.SIGNATURE_DATE = lstpcn.SIGNATURE_DATE; if (add == true) { DB.DD_PCN.InsertOnSubmit(lstEntity); } submit = true; DB.SubmitChanges(); return(true); } catch (System.Data.Linq.ChangeConflictException) { DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges); return(false); } catch (Exception ex) { if (submit == true) { if (add == true) { DB.DD_PCN.DeleteOnSubmit(lstEntity); } if (edit == true) { DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstEntity); } } DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstEntity); ex.LogException(); return(false); } }
/// <summary> /// type="ECN" - CUSTOMER , type="PCN" SFL /// </summary> /// <param name="partNo"></param> /// <param name="type"></param> /// <returns></returns> public List <DD_PCN> GetECNMPSDetails(decimal sNo, string screentype, ref string referenceNo) { List <DD_PCN> lstEntity = new List <DD_PCN>(); // DD_PCN lstEntity = null; string requestedBy = ""; try { requestedBy = (screentype == "MPS" ? "SFL" : "CUSTOMER"); if (!DB.IsNotNullOrEmpty()) { return(lstEntity); } IsDefaultSubmitRequired = false; lstEntity = (from row in DB.DD_PCN where row.SNO == sNo && row.REQUSTED_BY.ToUpper() == requestedBy select row).ToList <DD_PCN>(); DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstEntity); if (lstEntity == null || lstEntity.Count == 0) { lstEntity = null; DD_PCN lstPCN = new DD_PCN(); lstEntity = new List <DD_PCN>(); lstPCN.PART_NO = ""; lstPCN.ACTUAL_CHANGE_IMP = ""; lstPCN.APPROVED_BY = ""; lstPCN.CHANGE_EFFECTIVE = ""; lstPCN.COMPILED_BY = ""; lstPCN.CONTROL_PLAN = false; lstPCN.COST_DESC = ""; lstPCN.CUST_NAME = ""; lstPCN.CUST_PART_NO = ""; lstPCN.DATE_OF_PCN = null; lstPCN.DATE_OF_SIGN = null; lstPCN.DISPOSITION = ""; lstPCN.GAUGE_DWG = null; lstPCN.INFGG_INITIAL = ""; lstPCN.INFGG_QTY = ""; lstPCN.INHEAT_TREATMENT_INITIAL = ""; lstPCN.INHEAT_TREATMENT_QTY = ""; lstPCN.INWIP_INITIAL = ""; lstPCN.INWIP_QTY = ""; lstPCN.MANUFACTURE_PROCESS = ""; lstPCN.NATURE_OF_CHANGE = ""; lstPCN.OTHERS = false; lstPCN.PART_DESC = ""; lstPCN.PFD = false; lstPCN.PFMEA = false; lstPCN.PRODUCT_CHANGE_NO = ""; lstPCN.PRODUCT_DWG = false; lstPCN.RE_PPAP = false; lstPCN.RESON_FOR_CHANGE = ""; lstPCN.SEQUENCE_DWG = false; lstPCN.SFL_DRAW_ISSUE_DATE = null; lstPCN.SFL_DRAW_ISSUEDATE1 = null; lstPCN.SFL_DRAW_ISSUENO = null; lstPCN.SFL_DRAW_ISSUENO1 = null; //lstPCN.SNO = ; lstPCN.TOOL_DWG = false; lstEntity.Add(lstPCN); } GetCustomerDetails(lstEntity[0]); } catch (System.Data.Linq.ChangeConflictException) { DB.ChangeConflicts.ResolveAll(System.Data.Linq.RefreshMode.KeepChanges); return(null); } catch (Exception ex1) { DB.DD_PCN.Context.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, lstEntity[0]); ex1.LogException(); } return(lstEntity); }
/// <summary> /// /// </summary> /// <param name="entity"></param> private void ClearAllFields(DD_PCN entity) { try { entity.ECN_REFERENCE_NO = ""; entity.PART_NO = ""; entity.ACTUAL_CHANGE_IMP = ""; entity.APPROVED_BY = ""; entity.CHANGE_EFFECTIVE = ""; entity.COMPILED_BY = ""; entity.CONTROL_PLAN = false; entity.COST_DESC = ""; entity.CUST_NAME = ""; entity.CUST_PART_NO = ""; entity.DATE_OF_PCN = null; entity.DATE_OF_SIGN = null; entity.DISPOSITION = ""; entity.GAUGE_DWG = null; entity.INFGG_INITIAL = ""; entity.INFGG_QTY = ""; entity.INHEAT_TREATMENT_INITIAL = ""; entity.INHEAT_TREATMENT_QTY = ""; entity.INWIP_INITIAL = ""; entity.INWIP_QTY = ""; entity.MANUFACTURE_PROCESS = ""; entity.NATURE_OF_CHANGE = ""; entity.OTHERS = false; entity.PART_DESC = ""; entity.PFD = false; entity.PFMEA = false; entity.PRODUCT_CHANGE_NO = ""; entity.PRODUCT_DWG = false; entity.RE_PPAP = false; entity.RESON_FOR_CHANGE = ""; entity.SEQUENCE_DWG = false; entity.SFL_DRAW_ISSUE_DATE = null; entity.SFL_DRAW_ISSUEDATE1 = null; entity.SFL_DRAW_ISSUENO = null; entity.SFL_DRAW_ISSUENO1 = null; //lstEntity.SNO = ; entity.CUST_DWG_NO = ""; entity.CUST_DWG_NO_ISSUE = ""; entity.CUST_ISSUE_NO = null; entity.ROUTING_TAG = false; entity.FINISH_CODE_SAP_DWG = false; entity.WORK_INSTRUCTION = false; entity.SAP_SEQ_DWG_ISSUE_NO_UPD = false; entity.TOOL_DWG = false; ECNReferenceNo = ""; entity.SNO = 0; entity.GAUGE_DWG = false; entity.ALREADY_IN_EFFECT = false; entity.IMMEDIATE = false; entity.FROM_NEXT_HT_CYCLE = false; entity.FROM_NEXT_FORGING = false; } catch (Exception ex) { throw ex.LogException(); } }