using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using DataLinkMesWork1; namespace MesServerFunctions { public class Db { public static DataTable GetEngineType_Order(string opName, string Program_No, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int isCheckOk, out int planCount, out int haveUplaodCount, out int remainingQuantity, out string msg) { DataTable dt = new DataTable(); isCheckOk = 2; EngineTypeID = 0; EngineType = ""; EngineID = ""; OrderForm = ""; planCount = 0; haveUplaodCount = 0; remainingQuantity = 0; msg = ""; string produceName = "平芝_生产上线_判断机型订单是否匹配_分线"; SqlParameter[] thisParms = new SqlParameter[1]; thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); //thisParms[1] = new System.Data.SqlClient.SqlParameter("@PLC_机型代码", Program_No); if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt)) { if (dt.Rows.Count > 0) { EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]); EngineType = dt.Rows[0]["机型"].ToString(); EngineID = dt.Rows[0]["变速箱总成号"].ToString(); OrderForm = dt.Rows[0]["订单号"].ToString(); isCheckOk = Convert.ToInt32(dt.Rows[0]["是否匹配"]); planCount = Convert.ToInt32(dt.Rows[0]["计划上料数量"]); haveUplaodCount = Convert.ToInt32(dt.Rows[0]["已上料数量"]); remainingQuantity = Convert.ToInt32(dt.Rows[0]["待上料数量"]); msg = dt.Rows[0]["msg"].ToString(); return dt; } } return dt; } public static bool SubLine_WorkFinish(string EngineID, string opName, string OrderForm, int qualityMask) { DataTable dt = new DataTable(); string produceName = "合力_分装线上线完成_扣数"; SqlParameter[] thisParms = new SqlParameter[4]; thisParms[0] = new System.Data.SqlClient.SqlParameter("@差速器总成号", EngineID); thisParms[1] = new System.Data.SqlClient.SqlParameter("@工位号", opName); thisParms[2] = new System.Data.SqlClient.SqlParameter("@订单号", OrderForm); thisParms[3] = new System.Data.SqlClient.SqlParameter("@合格标志", qualityMask); if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt)) { return true; } return false; } public static bool UpdateWait_NUM_PLC(string opName, int Wait_NUM) { DataTable dt = new DataTable(); string produceName = "合力_分装线PLC_更新待上线数量"; SqlParameter[] thisParms = new SqlParameter[2]; thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); thisParms[1] = new System.Data.SqlClient.SqlParameter("@待上线数量", Wait_NUM); if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt)) { return true; } return false; } public static bool GethandType_Order(string opName, out int EngineTypeID, out string EngineType, out string EngineID, out string OrderForm, out int isCheckOk, out int planCount, out int haveUplaodCount, out int remainingQuantity) { DataTable dt = new DataTable(); isCheckOk = 2; EngineTypeID = 0; EngineType = ""; EngineID = ""; OrderForm = ""; planCount = 0; haveUplaodCount = 0; remainingQuantity = 0; string produceName = "合力_生产上线_分线_判断机型订单是否匹配"; SqlParameter[] thisParms = new SqlParameter[1]; thisParms[0] = new System.Data.SqlClient.SqlParameter("@工位号", opName); if (DataAccess.ExecuteStoredProcedure(produceName, ref thisParms, out dt)) { if (dt.Rows.Count > 0 && dt.Rows[0]["是否匹配"].ToString() == "1") { EngineTypeID = Convert.ToInt32(dt.Rows[0]["机型代码"]); EngineType = dt.Rows[0]["机型"].ToString(); EngineID = dt.Rows[0]["变速箱总成号"].ToString(); OrderForm = dt.Rows[0]["订单号"].ToString(); isCheckOk = Convert.ToInt32(dt.Rows[0]["是否匹配"]); planCount = Convert.ToInt32(dt.Rows[0]["计划上料数量"]); haveUplaodCount = Convert.ToInt32(dt.Rows[0]["已上料数量"]); remainingQuantity = Convert.ToInt32(dt.Rows[0]["待上料数量"]); return true; } } return false; } } }