private bool CheckErrData() { string sqlStr = @" SELECT K_ID 序号 FROM WG_DB.dbo.SC_PLAN LEFT JOIN COMFORT.dbo.COPTD ON RTRIM(TD001) + '-' + RTRIM(TD002) + '-' + RTRIM(TD003) = SC001 LEFT JOIN COMFORT.dbo.COPTQ ON TQ001 = TD004 AND TQ002 = TD053 LEFT JOIN COMFORT.dbo.COPTC ON TC001 = TD001 AND TC002 = TD002 LEFT JOIN COMFORT.dbo.COPMA ON MA001 = TC004 LEFT JOIN (SELECT SC2.SC001 SC2001, SUM(SC2.SC013) SC2013 FROM WG_DB.dbo.SC_PLAN AS SC2 WHERE SC2.SC003 <= CONVERT(VARCHAR(8), GETDATE(), 112) GROUP BY SC2.SC001) AS SC2 ON SC2001 = SC001 LEFT JOIN (SELECT SC3.SC001 SC3001, SUM(SC3.SC013) SC3013 FROM WG_DB.dbo.SC_PLAN AS SC3 GROUP BY SC3.SC001) AS SC3 ON SC3001 = SC001 LEFT JOIN (SELECT SUM(TA015) TA015, TA006, RTRIM(TA026)+'-'+RTRIM(TA027)+'-'+RTRIM(TA028) TD, UDF02 FROM COMFORT.dbo.MOCTA WHERE TA013 NOT IN ('V', 'U') GROUP BY RTRIM(TA026)+'-'+RTRIM(TA027)+'-'+RTRIM(TA028), TA006, UDF02) AS MOCTA ON MOCTA.TD = SC001 AND MOCTA.UDF02 = K_ID AND MOCTA.TA006 = SC028 LEFT JOIN COMFORT.dbo.INVMB ON TD004 = MB001 WHERE 1 = 1 "; sqlStr += string.Format(@" AND SC003 >= '{0}' ", DtpStartDate.Value.ToString("yyyyMMdd")); sqlStr += string.Format(@" AND SC003 <= '{0}' ", DtpEndDate.Value.ToString("yyyyMMdd")); if (CmBoxDptType.Text != "全部") { sqlStr += string.Format(@" AND SC023 LIKE '%{0}%' ", CmBoxDptType.Text); } sqlStr += @"AND SC013 != ISNULL(CAST(MOCTA.TA015 AS FLOAT), 0) "; return(mssql.SQLexist(connWG, sqlStr)); }
/// <summary> /// 查询替换品号是否存在于此客户配置 /// </summary> /// <param name="tq001">成品品号</param> /// <param name="tq002">客户配置名称</param> /// <param name="tr003">上阶层级码</param> /// <param name="wlnoNew">替换品号</param> /// <returns></returns> private bool GetExistWlno(string tq001, string tq002, string tr003, string wlnoNew) { string sql = string.Format("SELECT TR017 FROM COPTR WHERE TR001='{0}' AND TR002='{1}' AND SUBSTRING(TR003, 1, LEN(TR003)-3)='{2}' AND TR009='{3}' AND TR017 = 'N' ", tq001, tq002, tr003, wlnoNew); return(mssql.SQLexist(connYF, sql)); }
private bool GetPreExistPlanData(int rowIndex) { string dd = DgvPreDo.Rows[rowIndex].Cells["生产单号"].Value.ToString(); string sl = DgvPreDo.Rows[rowIndex].Cells["上线数量"].Value.ToString(); string dpt = DgvPreDo.Rows[rowIndex].Cells["生产车间"].Value.ToString(); string rq = DgvPreDo.Rows[rowIndex].Cells["上线日期"].Value.ToString().Replace("-", ""); string sqlStr = @"SELECT 1 FROM SC_PLAN(NOLOCK) WHERE SC001 = '{0}' AND SC003 = '{1}' AND SC013 = '{2}' AND SC023 = '{3}' "; return(mssql.SQLexist(connWG, string.Format(sqlStr, dd, rq, sl, dpt))); }
/// <summary> /// 获取配置信息 /// </summary> /// <param name="configName"></param> /// <param name="typeName"></param> /// <returns></returns> public static bool GetConfig(string configName, string typeName) { if (configName != null && typeName != null) { Mssql sql = new Mssql(); string sqlStr = @"SELECT Valid FROM WG_CONFIG WHERE ConfigName = '{0}' AND Type = '{1}' AND Valid = 'Y' "; return(sql.SQLexist(connWG, string.Format(sqlStr, configName, typeName))); } else { return(false); } }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text == "") { Msg.ShowErr("排程部门不能为空"); } else { string slqStr2 = @"SELECT 1 FROM dbo.SC_PLAN_DPT_TYPE WHERE Type = 'In' AND Dpt = '{0}' "; if (mssql.SQLexist(connWG, string.Format(slqStr2, textBox2.Text))) { Msg.ShowErr("当前信息已存在,保存失败"); } else { string slqStr = @"INSERT INTO dbo.SC_PLAN_DPT_TYPE (K_ID, [Type], Dpt, ERPDpt, Valid) VALUES((SELECT MAX(K_ID)+1 FROM dbo.SC_PLAN_DPT_TYPE WHERE [Type] = '{0}'), '{0}', '{1}', '{2}', 1) "; mssql.SQLexcute(connWG, string.Format(slqStr, ComboBoxDptType.Text.Replace("导入", "In").Replace("导出", "Out"), textBox2.Text, textBox1.Text)); Msg.Show("已添加"); textBox2.Text = ""; } } }
private bool GetCreateSingleLL() { string sqlStr = @"SELECT K_ID FROM dbo.WG_CONFIG WHERE ConfigName = 'ERP_CreateSingleLL' AND Type = 'Work' AND Valid = 'Y' "; return(mssql.SQLexist(infObjLL.connWG, sqlStr)); }
private bool checkMOCTC(string danbie, string danhao) { string slqStr = "SELECT TC001, TC002 FROM MOCTC WHERE TC001 = '{0}' AND TC002 = '{1}'"; return(mssql.SQLexist(connYF, string.Format(slqStr, danbie, danhao))); }