コード例 #1
0
ファイル: SQLStatement.cs プロジェクト: wra222/testgit
        public static List<CompleteMO> GetCompleteProductMO(EnumProductMOState status, string isRework)
        {
            List<CompleteMO> moList = new List<CompleteMO>();
            string strSQL = @"SELECT MO, IsParentMO, count(MO) AS Qty 
                                              FROM ProductMO
                                              WHERE Status=@Status AND IsRework=@Rework
                                              GROUP BY IsParentMO, MO
                                              ORDER BY IsParentMO, MO ";             

            DataTable dt = SQLHelper.ExecuteDataFill(SQLHelper.ConnectionString_CFG(),
                                                     System.Data.CommandType.Text,
                                                     strSQL,
                                                     SQLHelper.CreateSqlParameter("@Status", 20, status.ToString().Trim()),
                                                     SQLHelper.CreateSqlParameter("@Rework", 1, isRework));
            foreach( DataRow dr in dt.Rows)
            {

                moList.Add(new CompleteMO
                                            {
                                                MOId = dr["MO"].ToString().Trim(),
                                                IsParentMO = dr["IsParentMO"].ToString().Trim(),
                                                Qty = (int)dr["Qty"]
                                            });  
            }

            return moList;
        }
コード例 #2
0
ファイル: SQLStatement.cs プロジェクト: wra222/testgit
        public static void UpdateProductMOReworkStatusAndInsertLog(string function,
                                                                   string action,
                                                                   List<string> productIdList,
                                                                   string txnId,
                                                                   string station,
                                                                   DateTime udt,
                                                                   string editor,
                                                                   EnumProductMOState CheckReworkState,
                                                                   string moId)
        {
            string strSQL = @"UPDATE ProductMO
                              SET IsRework='Y',
                                  LastTxnId =@LastTxnId,
                                  Udt =@now
                              WHERE ProductID in ({0}) AND MO=@moId AND Status!=@ReworkState
                                 
                              INSERT ProductMOLog(ProductID, MO, [Function], [Action], IsParentMO, 
                                                 Station, PreStatus, Status, IsRework, IsHold, 
                                                 TxnId, Comment, Editor, Cdt)
                              SELECT ProductID, MO, @Function, @Action, IsParentMO, 
                                      @Station, Status,  Status, 'Y', IsHold, 
                                      @LastTxnId,'',@editor , @now
                              FROM  ProductMO
                              WHERE ProductID in ({0}) AND MO=@moId AND Status!=@ReworkState ";

            string inSQLStr = "'" + string.Join("','", productIdList.ToArray()) + "'";
            strSQL = string.Format(strSQL, inSQLStr);

            SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString_CFG(),
                                      System.Data.CommandType.Text,
                                      strSQL,
                                      SQLHelper.CreateSqlParameter("@Function", 32, function),
                                      SQLHelper.CreateSqlParameter("@Action", 32, action),
                                      SQLHelper.CreateSqlParameter("@LastTxnId", 32, txnId),
                                      SQLHelper.CreateSqlParameter("@Station", 32, station),
                                      SQLHelper.CreateSqlParameter("@editor", 32, editor),
                                      SQLHelper.CreateSqlParameter("@now", udt),
                                      SQLHelper.CreateSqlParameter("@moId", 32, moId),
                                      SQLHelper.CreateSqlParameter("@ReworkState", 32, CheckReworkState.ToString().Trim()));
        }