// search for imposition method (for T230 RBA Branch) internal static string impoMethod(string machine, string itemCode) { string sql = "SELECT imposition.method " + "FROM imposition " + "RIGHT JOIN process " + "ON CAST(COALESCE(imposition.process,'0') AS INTEGER ) = process.id " + "RIGHT JOIN productgroup " + "ON imposition.id = productgroup.impid " + "RIGHT JOIN productgroupmembers " + "ON productgroup.id = productgroupmembers.groupid " + "WHERE process.process = :machine " + "AND productgroupmembers.stockcode = :item_code; "; string[] parameterNames = { "machine", "item_code" }; string[] parameterVals = { machine, itemCode }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); if (!string.IsNullOrEmpty(scalarRequestString)) { return(scalarRequestString); } else { throw new FormatException("Can't find Imposition stepping for: " + itemCode); } }
// Asset Exists boolean method static internal bool assetExists(string itemCode) { string sql = "SELECT id FROM asset where name= :stock_code"; string[] parameterNames = new string[] { "stock_code" }; string [] parameterVals = new string[] { itemCode }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); return(!string.IsNullOrEmpty(scalarRequestString)); }
private static productType productTypeStaticSearch(string sql, string[] parameterNames, AWF myAWF, int itemSequence) { string[] parameterVals = { myAWF.Products.Item[itemSequence].ItemCode }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); if (!string.IsNullOrEmpty(scalarRequestString)) { return((productType)(Convert.ToInt32(scalarRequestString))); } else { throw new FormatException(string.Format("job/pd#: {0}, item: {1}, returns no 'type' value from DB", myAWF.JobNumber.ToString(), myAWF.Products.Item[itemSequence].ItemCode)); } }
//check if static item is active, i.e. exists or not disabled private static bool isStaticActive(string sql, string[] parameterNames, AWF myAWF, int itemSequence) { string[] parameterVals = { myAWF.Products.Item[itemSequence].ItemCode }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); if (!string.IsNullOrEmpty(scalarRequestString)) { return(0 == Convert.ToInt32(scalarRequestString)); } else { throw new FormatException(string.Format("job/pd#: {0}, item: {1}, returns no 'status' value from prinlut 'asset' table", myAWF.JobNumber.ToString(), myAWF.Products.Item[itemSequence].ItemCode)); } }
// product type internal static productType getProductType(AWF myAWF, int itemSequence, RBA_Variables variables) { string sql = "SELECT type " + "FROM asset " + "WHERE name = :asset_name; "; string[] parameterNames = { "asset_name" }; string[] parameterVals = { string.Format("{0}{1} {2} {3}", variables.VASSET_PREFIX, myAWF.Products.Item[itemSequence].SourcePDNumber, myAWF.Products.Item[itemSequence].SourcePDLine, myAWF.Products.Item[itemSequence].ItemCode) }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); return(String.IsNullOrEmpty(scalarRequestString) ? productTypeStaticSearch(sql, parameterNames, myAWF, itemSequence) : (productType)(Convert.ToInt32(scalarRequestString))); }
// Path to job in Workshop internal static string newJobPath(string prismCustomer) { string sql = "SELECT prin_path " + "FROM customer " + "WHERE rparent = :prism_customer; "; string[] parameterNames = { "prism_customer" }; string[] parameterVals = { prismCustomer }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); if (!string.IsNullOrEmpty(scalarRequestString)) { return(scalarRequestString); } else { throw new Exception("Customer: " + prismCustomer + " returns no 'prin_path' value from DB"); } }
internal static string processType(string machine) { string sql = "SELECT type " + "FROM process " + "WHERE process = :machine"; string[] parameterNames = { "machine" }; string[] parameterVals = { machine }; string scalarRequestString = AWFPostgresDataLayer.SelectScalar(sql, parameterNames, parameterVals); if (!string.IsNullOrEmpty(scalarRequestString)) { return(scalarRequestString); } else { throw new Exception("Can't find process type for: " + machine); } }