/**Update Mtracker Table*/ Object item=param(1); string Location=param(2); Table MTracker= Table("MATERIAL_TRACKER"); Table Masterdata = Table("MASTERDATA"); Table PCBFLow = Table("PCBFLow"); int qty; string PNum = item.PartNo; if(item.name == "MAGAZINE" || item.name == "Bag") { int PCBsperPanel = Masterdata[PNum]["Panel"]; qty = PCBsperPanel*item.subnodes.length; } else { qty = item.subnodes.length; } MTracker[PNum][Location] = MTracker[PNum][Location] + qty; // Update Mtracker table // NEW CODE (CREASHES IF I PUT NEW BREAKPOINT IN ANY LINE OF THIS CODE, BUT SOMETIMES ALS CREASED IF BREAKPOINT PUT IN OTHER CODES string Prefix = stringcopy(Location, 1, 5); if (Prefix == "FASSY") { // Update on status in front of FASSY lines string Family = Masterdata[PNum]["Family"]; string PCBName = Masterdata[PNum]["Name"]; Table ProdWeeks = Table("ProdWeeks"); Table Products = Table("Products"); int ActualQty = MTracker[PNum][Location]; string ParentPN="0"; for (int i = 1; i <= 12; i++) { int PartNotoCheck = Products[i][PCBName]; if(PartNotoCheck == PNum) { // Checks what is the PArent PN ParentPN = Products.getRowHeader(i); if(Family == "11kW") { // Checks is there is whole set available int SysPN = Products[ParentPN]["11kW System"]; int PFCPN = Products[ParentPN]["11kW PFC"]; int DCDCPN = Products[ParentPN]["11kW DCDC"]; int DCFilterPN = Products[ParentPN]["11kW DC Filter"]; int SysQty = MTracker[numtostring(SysPN)]["FASSY11kW_11kW System"]; int PFCQty = MTracker[numtostring(PFCPN)]["FASSY11kW_11kW PFC"]; int DCDCQty = MTracker[numtostring(DCDCPN)]["FASSY11kW_11kW DCDC"]; int DCFilterQty = MTracker[numtostring(DCFilterPN)]["FASSY11kW_11kW DC Filter"]; int ParentQty = minof(minof(SysQty,PFCQty),minof(DCDCQty,DCFilterQty)); if (ParentQty > 0) { ProdWeeks[ParentPN]["Current_Pre_FASSY"] = ParentQty; } } if(Family == "7.2kW") { // Checks is there is whole set available int SysPN = Products[ParentPN]["7.2kW System"]; int PFCPN = Products[ParentPN]["7.2kW PFC"]; int DCDCPN = Products[ParentPN]["7.2kW DCDC"]; int DCFilterPN = Products[ParentPN]["7.2kW DC Filter"]; int TNVPN = Products[ParentPN]["7.2kW TNV"]; int SysQty = MTracker[numtostring(SysPN)]["FASSY72kW_7.2 System"]; int PFCQty = MTracker[numtostring(PFCPN)]["FASSY72kW_7.2 PFC"]; int DCDCQty = MTracker[numtostring(DCDCPN)]["FASSY72kW_7.2 DCDC"]; int DCFilterQty = MTracker[numtostring(DCFilterPN)]["FASSY72kW_7.2 DC Filter"]; int TNVQty = MTracker[numtostring(TNVPN)]["FASSY72kW_TNV Adaptor"]; int ParentQty = minof(minof(minof(SysQty,PFCQty),minof(DCDCQty,DCFilterQty)),TNVQty); if (ParentQty > 0) { ProdWeeks[ParentPN]["Current_Pre_FASSY"] = ParentQty; } } if(Family == "Gen2.x") { // Checks is there is whole set available int SysPN = Products[ParentPN]["Gen 2.x System"]; int PowerPN = Products[ParentPN]["Gen 2.x Power Supply"]; int ComPN = Products[ParentPN]["Gen 2.x Com"]; int SysQty = MTracker[numtostring(SysPN)]["FASSYGen2.x_System"]; int PowerQty = MTracker[numtostring(PowerPN)]["FASSYGen2.x_Power"]; int ComQty = MTracker[numtostring(ComPN)]["FASSYGen2.x_COM"]; int ParentQty = minof(minof(SysQty,PowerQty),ComQty); if (ParentQty > 0) { ProdWeeks[ParentPN]["Current_Pre_FASSY"] = ParentQty; } } } } } // END OF NEW CODE if (Location == "Massy Bay1") { // Updates Wave 1 Table Table Wave1Tab = Table("Wave1Table"); Wave1Tab[PNum]["Qty"] = Wave1Tab[PNum]["Qty"] + qty; int IfChild = Masterdata[PNum]["Daughterboard"]; string ParentNo; if (IfChild == 1) { // Checks if whole set is available int MasterRows = Masterdata.numRows; for (int i = 1; i <= MasterRows; i++) { string ChildNo = numtostring(Masterdata[i]["Child 1"]); if (ChildNo == PNum) { ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave1Tab[ParentNo]["Qty"]; if (ParentQty>0) { Wave1Tab[ParentNo]["Set"] = "Yes"; } } } } else { string ChildNo = numtostring(Masterdata[PNum]["Child 1"]); int ChildQty = Wave1Tab[ChildNo]["Qty"]; if (ChildQty >0) { Wave1Tab[PNum]["Set"] = "Yes"; } ParentNo = PNum; } string ParentName = Wave1Tab[ParentNo]["Name"]; // Check if Pair of PFC and DCDC is available Table Products = Table("Products"); int ProductsRows = Products.numRows; string OtherParent; for (int i = 1; i <= ProductsRows; i++) { string PCB = numtostring(Products[i][ParentName]); string MainUnit; if (PCB == ParentNo) { MainUnit = Products.getRowHeader(i); if(ParentName == "11kW PFC") { OtherParent = numtostring(Products[i]["11kW DCDC"]); } if(ParentName == "11kW DCDC") { OtherParent = numtostring(Products[i]["11kW PFC"]); } break; } } string ParentSet = Wave1Tab[ParentNo]["Set"]; string OtherParentSet = Wave1Tab[OtherParent]["Set"]; if(ParentSet =="Yes" && OtherParentSet =="Yes") { if(ParentName == "11kW PFC") { Wave1Tab[ParentNo]["Pair"] = "Yes"; } else { Wave1Tab[OtherParent]["Pair"] = "Yes"; } } } if (Location == "Massy Bay8") { // Updates Wave 8 Table Table Wave8Tab = Table("Wave8Table"); Wave8Tab[PNum]["Qty"] = Wave8Tab[PNum]["Qty"] + qty; int IfChild = Masterdata[PNum]["Daughterboard"]; string ParentNo; if (IfChild == 1) { // Checks if whole set is available int MasterRows = Masterdata.numRows; for (int i = 1; i <= MasterRows; i++) { string ChildNo1 = numtostring(Masterdata[i]["Child 1"]); string ChildNo2 = numtostring(Masterdata[i]["Child 2"]); if (ChildNo1 == PNum) { // if PN of unit coming is Child 1 check is there parent and Child 2 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave8Tab[ParentNo]["Qty"]; int Child2PN = Masterdata[i]["Child 2"]; if (Child2PN > 0) { string Child2PNStr = numtostring(Child2PN); int Child2Qty = Wave8Tab[Child2PNStr]["Qty"]; if (ParentQty>0 && Child2Qty>0) { Wave8Tab[ParentNo]["Set"] = "Yes"; break; } } else { if (ParentQty>0) { Wave8Tab[ParentNo]["Set"] = "Yes"; break; } } } if (ChildNo2 == PNum) { // if PN of unit coming is Child 2 check is there parent and Child 1 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave8Tab[ParentNo]["Qty"]; string Child1PNStr = numtostring(Masterdata[i]["Child 1"]); int Child1Qty = Wave8Tab[Child1PNStr]["Qty"]; if (ParentQty>0 && Child1Qty>0) { Wave8Tab[ParentNo]["Set"] = "Yes"; break; } } } } else { string Child1No = numtostring(Masterdata[PNum]["Child 1"]); string Child2No = numtostring(Masterdata[PNum]["Child 2"]); int Child1Qty = Wave8Tab[Child1No]["Qty"]; if (Child2No == "0") { if (Child1Qty > 0) { Wave8Tab[PNum]["Set"] = "Yes"; } } else { int Child2Qty = Wave8Tab[Child2No]["Qty"]; if (Child1Qty > 0 && Child2Qty>0) { Wave8Tab[PNum]["Set"] = "Yes"; } } } } if (Location == "Massy Bay7") { // Updates Wave 7 Table string Packing = item.name; string Family = item.Name; if (Family == "11kW DC Filter") { Table Wave7Tab = Table("Wave7Table_Sets"); Wave7Tab[PNum]["Qty"] = Wave7Tab[PNum]["Qty"] + qty; string ParentNo; int IfChild = Masterdata[PNum]["Daughterboard"]; if (IfChild == 1) { // Check if it is child or parent int MasterRows = Masterdata.numRows; for (int i = 1; i <= MasterRows; i++) { string ChildNo1 = numtostring(Masterdata[i]["Child 1"]); // string ChildNo2 = numtostring(Masterdata[i]["Child 2"]); if (ChildNo1 == PNum) { // if PN of unit coming is Child 1 check is there parent and Child 2 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave7Tab[ParentNo]["Qty"]; //int Child2PN = Masterdata[i]["Child 2"]; //if (Child2PN > 0) { //string Child2PNStr = numtostring(Child2PN); //int Child2Qty = Wave7Tab[Child2PNStr]["Qty"]; if (ParentQty>0 /*&& Child2Qty>0*/) { Wave7Tab[ParentNo]["Set"] = "Yes"; // Set set availability as yes if there is a parent break; } //} else { //if (ParentQty>0) { //Wave7Tab[ParentNo]["Set"] = "Yes"; //break; //} } } /*if (ChildNo2 == PNum) { // if PN of unit coming is Child 2 check is there parent and Child 1 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave7Tab[ParentNo]["Qty"]; string Child1PNStr = numtostring(Masterdata[i]["Child 1"]); int Child1Qty = Wave7Tab[Child1PNStr]["Qty"]; if (ParentQty>0 && Child1Qty>0) { Wave7Tab[ParentNo]["Set"] = "Yes"; break; } } */ } else { // If unit is a parent string Child1No = numtostring(Masterdata[PNum]["Child 1"]); //string Child2No = numtostring(Masterdata[PNum]["Child 2"]); int Child1Qty = Wave7Tab[Child1No]["Qty"]; //if (Child2No == "0") { //if (Child1Qty > 0) { //Wave7Tab[PNum]["Set"] = "Yes"; //} //} else { //int Child2Qty = Wave7Tab[Child2No]["Qty"]; if (Child1Qty > 0 /*&& Child2Qty>0*/) { Wave7Tab[PNum]["Set"] = "Yes"; } //} } } else { // If it is multiup with no sets Table Wave7Tab = Table("Wave7Table_Others"); Wave7Tab[PNum]["Qty"] = Wave7Tab[PNum]["Qty"] + qty; } } if (Location == "Massy Bay7 Boxes") { // Updates Wave 7 Table Table Wave7Tab = Table("Wave7Table_Sets"); Wave7Tab[PNum]["Qty"] = Wave7Tab[PNum]["Qty"] + qty; string ParentNo; int IfChild = Masterdata[PNum]["Daughterboard"]; if (IfChild == 1) { // Check if it is child or parent int MasterRows = Masterdata.numRows; for (int i = 1; i <= MasterRows; i++) { string ChildNo1 = numtostring(Masterdata[i]["Child 1"]); // string ChildNo2 = numtostring(Masterdata[i]["Child 2"]); if (ChildNo1 == PNum) { // if PN of unit coming is Child 1 check is there parent and Child 2 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave7Tab[ParentNo]["Qty"]; //int Child2PN = Masterdata[i]["Child 2"]; //if (Child2PN > 0) { //string Child2PNStr = numtostring(Child2PN); //int Child2Qty = Wave7Tab[Child2PNStr]["Qty"]; if (ParentQty>0 /*&& Child2Qty>0*/) { Wave7Tab[ParentNo]["Set"] = "Yes"; // Set set availability as yes if there is a parent break; } //} else { //if (ParentQty>0) { //Wave7Tab[ParentNo]["Set"] = "Yes"; //break; //} } } /*if (ChildNo2 == PNum) { // if PN of unit coming is Child 2 check is there parent and Child 1 avaialble ParentNo = Masterdata.getRowHeader(i); int ParentQty = Wave7Tab[ParentNo]["Qty"]; string Child1PNStr = numtostring(Masterdata[i]["Child 1"]); int Child1Qty = Wave7Tab[Child1PNStr]["Qty"]; if (ParentQty>0 && Child1Qty>0) { Wave7Tab[ParentNo]["Set"] = "Yes"; break; } } */ } else { // If unit is a parent string Child1No = numtostring(Masterdata[PNum]["Child 1"]); //string Child2No = numtostring(Masterdata[PNum]["Child 2"]); int Child1Qty = Wave7Tab[Child1No]["Qty"]; //if (Child2No == "0") { //if (Child1Qty > 0) { //Wave7Tab[PNum]["Set"] = "Yes"; //} //} else { //int Child2Qty = Wave7Tab[Child2No]["Qty"]; if (Child1Qty > 0 /*&& Child2Qty>0*/) { Wave7Tab[PNum]["Set"] = "Yes"; } //} } } if (Location == "Massy SS") { // Updates Seletive string Family = item.Name; Table SelTab = Table("SelectiveTable"); SelTab[PNum]["Qty"] = SelTab[PNum]["Qty"] + qty; if (Family == "11kW System") { string ChildNo1 = "12045095"; int ChildQty = SelTab[ChildNo1]["Qty"]; if (ChildQty>0) { SelTab[PNum]["Set"] = "Yes"; // Set set availability as yes if there is a child } } if (Family == "11kW COM") { for (int i = 2; i <= 4; i++) { if(SelTab[i]["Qty"] >0) { SelTab[i]["Set"] = "Yes"; // Set set availability as yes if there is a parent } } } } int n =0; string Process; int MASSY= 0; for (int i = 2; i <= 7; i++) { // check which step is it and update PCBFLow Table Process = PCBFLow[PNum][i]; if (Process == Location) { n=i; break; } string Curproc = stringcopy(Process,1,5); if (Curproc == "Massy") { MASSY = 1; // If process is post MASSY set the MASSY factor to 1 } } string Step = PCBFLow.getColHeader(n); if (Step == "Step 2") { PCBFLow[PNum]["Step 2 Qty"]=PCBFLow[PNum]["Step 2 Qty"] + qty; PCBFLow[PNum]["Post Step 1"]=PCBFLow[PNum]["Post Step 1"] + qty; } if (Step == "Step 3") { PCBFLow[PNum]["Step 3 Qty"]=PCBFLow[PNum]["Step 3 Qty"] + qty; PCBFLow[PNum]["Post Step 1"]=PCBFLow[PNum]["Post Step 1"] + qty; PCBFLow[PNum]["Post Step 2"]=PCBFLow[PNum]["Post Step 2"] + qty; } if (Step == "Step 4") { PCBFLow[PNum]["Step 4 Qty"]=PCBFLow[PNum]["Step 4 Qty"] + qty; PCBFLow[PNum]["Post Step 1"]=PCBFLow[PNum]["Post Step 1"] + qty; PCBFLow[PNum]["Post Step 2"]=PCBFLow[PNum]["Post Step 2"] + qty; PCBFLow[PNum]["Post Step 3"]=PCBFLow[PNum]["Post Step 3"] + qty; } if (Step == "Step 5") { PCBFLow[PNum]["Step 5 Qty"]=PCBFLow[PNum]["Step 5 Qty"] + qty; PCBFLow[PNum]["Post Step 1"]=PCBFLow[PNum]["Post Step 1"] + qty; PCBFLow[PNum]["Post Step 2"]=PCBFLow[PNum]["Post Step 2"] + qty; PCBFLow[PNum]["Post Step 3"]=PCBFLow[PNum]["Post Step 3"] + qty; PCBFLow[PNum]["Post Step 4"]=PCBFLow[PNum]["Post Step 4"] + qty; } if (Step == "Step 6") { PCBFLow[PNum]["Step 6 Qty"]=PCBFLow[PNum]["Step 6 Qty"] + qty; PCBFLow[PNum]["Post Step 1"]=PCBFLow[PNum]["Post Step 1"] + qty; PCBFLow[PNum]["Post Step 2"]=PCBFLow[PNum]["Post Step 2"] + qty; PCBFLow[PNum]["Post Step 3"]=PCBFLow[PNum]["Post Step 3"] + qty; PCBFLow[PNum]["Post Step 4"]=PCBFLow[PNum]["Post Step 4"] + qty; PCBFLow[PNum]["Post Step 5"]=PCBFLow[PNum]["Post Step 5"] + qty; } int Children = Masterdata[PNum]["Children"]; // Upgrade children status if parent available if(Children >0 && MASSY == 1) { string ChildPN = numtostring(Masterdata[PNum]["Child 1"]); string StepChild; for (int i = 4; i <= 7; i++) { string ProcChild = PCBFLow[ChildPN][i]; if (ProcChild == "PostMASSY" ) { StepChild = PCBFLow.getColHeader(i); break; } } if (StepChild == "Step 3") { PCBFLow[ChildPN]["Step 3 Qty"]=PCBFLow[ChildPN]["Step 3 Qty"] + qty; PCBFLow[ChildPN]["Post Step 1"]=PCBFLow[ChildPN]["Post Step 1"] + qty; PCBFLow[ChildPN]["Post Step 2"]=PCBFLow[ChildPN]["Post Step 2"] + qty; } if (StepChild == "Step 4") { PCBFLow[ChildPN]["Step 4 Qty"]=PCBFLow[ChildPN]["Step 4 Qty"] + qty; PCBFLow[ChildPN]["Post Step 1"]=PCBFLow[ChildPN]["Post Step 1"] + qty; PCBFLow[ChildPN]["Post Step 2"]=PCBFLow[ChildPN]["Post Step 2"] + qty; PCBFLow[ChildPN]["Post Step 3"]=PCBFLow[ChildPN]["Post Step 3"] + qty; } if (StepChild == "Step 5") { PCBFLow[ChildPN]["Step 5 Qty"]=PCBFLow[ChildPN]["Step 5 Qty"] + qty; PCBFLow[ChildPN]["Post Step 1"]=PCBFLow[ChildPN]["Post Step 1"] + qty; PCBFLow[ChildPN]["Post Step 2"]=PCBFLow[ChildPN]["Post Step 2"] + qty; PCBFLow[ChildPN]["Post Step 3"]=PCBFLow[ChildPN]["Post Step 3"] + qty; PCBFLow[ChildPN]["Post Step 4"]=PCBFLow[ChildPN]["Post Step 4"] + qty; } if(Children >1) { string Child2PN = numtostring(Masterdata[PNum]["Child 2"]); string StepChild2; for (int i = 4; i <= 7; i++) { string ProcChild = PCBFLow[Child2PN][i]; if (ProcChild == "PostMASSY" ) { StepChild2 = PCBFLow.getColHeader(i); break; } } if (StepChild2 == "Step 3") { PCBFLow[Child2PN]["Step 3 Qty"]=PCBFLow[Child2PN]["Step 3 Qty"] + qty; PCBFLow[Child2PN]["Post Step 1"]=PCBFLow[Child2PN]["Post Step 1"] + qty; PCBFLow[Child2PN]["Post Step 2"]=PCBFLow[Child2PN]["Post Step 2"] + qty; } if (StepChild2 == "Step 4") { PCBFLow[Child2PN]["Step 4 Qty"]=PCBFLow[Child2PN]["Step 4 Qty"] + qty; PCBFLow[Child2PN]["Post Step 1"]=PCBFLow[Child2PN]["Post Step 1"] + qty; PCBFLow[Child2PN]["Post Step 2"]=PCBFLow[Child2PN]["Post Step 2"] + qty; PCBFLow[Child2PN]["Post Step 3"]=PCBFLow[Child2PN]["Post Step 3"] + qty; } if (StepChild2 == "Step 5") { PCBFLow[Child2PN]["Step 5 Qty"]=PCBFLow[Child2PN]["Step 5 Qty"] + qty; PCBFLow[Child2PN]["Post Step 1"]=PCBFLow[Child2PN]["Post Step 1"] + qty; PCBFLow[Child2PN]["Post Step 2"]=PCBFLow[Child2PN]["Post Step 2"] + qty; PCBFLow[Child2PN]["Post Step 3"]=PCBFLow[Child2PN]["Post Step 3"] + qty; PCBFLow[Child2PN]["Post Step 4"]=PCBFLow[Child2PN]["Post Step 4"] + qty; } } }