// generate production batch string public List <string> GenerateProductionBatch() { List <string> batch = new List <string>(); // add detail record DetailRecord detail = new DetailRecord(); detail.department.SetString(depCode); detail.resource.SetString(resCode); detail.part.SetString(part); detail.workOrder.SetString(woNum); detail.seq.SetString(seqNum.ToString("D3")); if (actualTime > 99.0) { actualTime = 99.0; } string hours = ((int)actualTime).ToString("D2"); string minutes = (((int)(actualTime * 100.0) % 100) * 60 / 100).ToString("D2"); detail.totalMachTime.SetString(hours + minutes); batch.Add(detail.BuildString()); // add production record ProductionRecord product = new ProductionRecord(); product.part.SetString(part); product.quaGood.SetString("0000000001"); product.units.SetString("EA"); product.empDep.SetString(depCode); product.empNum.SetString((empNum % 100000).ToString()); product.reversing.SetString("N"); batch.Add(product.BuildString()); return(batch); }
// generate batch string to update existing time public List <string> GenerateUpdateBatch() { List <string> batch = new List <string>(); // add detail record DetailRecord detail = new DetailRecord(); detail.department.SetString(depCode); detail.resource.SetString(resCode); detail.part.SetString(part); detail.workOrder.SetString(woNum); detail.seq.SetString(seqNum.ToString("D3")); if (actualTime > 99.0) { actualTime = 99.0; } string hours = ((int)actualTime).ToString("D2"); string minutes = (((int)(actualTime * 100.0) % 100) * 60 / 100).ToString("D2"); detail.totalMachTime.SetString(hours + minutes); batch.Add(detail.BuildString()); return(batch); }
// generate material batch string public List <string> GenerateMaterialBatch() { List <string> batch = new List <string>(); // add detail record DetailRecord detail = new DetailRecord(); detail.department.SetString(depCode); detail.resource.SetString(resCode); detail.part.SetString(part); detail.workOrder.SetString(woNum); detail.seq.SetString(seqNum.ToString("D3")); string hours = ((int)actualTime).ToString("D2"); string minutes = (((int)(actualTime * 100.0) % 100) * 60 / 100).ToString("D2"); detail.totalMachTime.SetString(hours + minutes); batch.Add(detail.BuildString()); // add production record ProductionRecord product = new ProductionRecord(); product.part.SetString(part); product.quaGood.SetString("0000000001"); product.units.SetString("EA"); product.empDep.SetString(depCode); product.empNum.SetString((empNum % 100000).ToString()); product.noBackFlush.SetString("Y"); batch.Add(product.BuildString()); // add material steel record MaterialRecord matSteel = new MaterialRecord(); string query = "select efmtlp, efqppc from cmsdat.cjobdm where efjob#='" + woNum + "'"; ExcoODBC odbcConnection = ExcoODBC.Instance; odbcConnection.Open(Database.CMSDAT); OdbcDataReader reader = odbcConnection.RunQuery(query); if (reader.Read()) { matSteel.part.SetString(reader[0].ToString().Trim()); matSteel.quantity.SetString(Convert.ToInt32((Convert.ToDouble(reader[1]) * 100000.0)).ToString("D15")); } reader.Close(); matSteel.stoRoom.SetString("STL"); matSteel.required.SetString("R"); matSteel.backFlush.SetString("Y"); matSteel.matScr.SetString("N"); matSteel.units.SetString("IN"); batch.Add(matSteel.BuildString()); // add material production record query = "select * from cmsdat.cjobdr where edjob#='" + woNum + "' and edseq#=30"; reader = odbcConnection.RunQuery(query); if (reader.Read()) { MaterialRecord matProd = new MaterialRecord(); matProd.part.SetString(part); matProd.quantity.SetString("000000000100000"); matProd.stoRoom.SetString("PRD"); matProd.required.SetString("R"); matProd.backFlush.SetString("Y"); matProd.matScr.SetString("N"); matProd.units.SetString("EA"); matProd.seqNum.SetString("030"); batch.Add(matProd.BuildString()); } reader.Close(); return(batch); }