Exemplo n.º 1
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            LineItemCycleTimeVo inVo = (LineItemCycleTimeVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append(" Update m_line_sap_item");
            sqlQuery.Append(" Set cycle_time = :stdcycletime, ");
            sqlQuery.Append(" registration_user_cd = :registrationusercd, ");
            sqlQuery.Append(" registration_date_time = :registrationdatetime ");
            sqlQuery.Append(" Where factory_cd = :factcode");
            sqlQuery.Append("   and line_sap_item_id = :lineitemcycletimeid ");
            //sqlQuery.Append("   and line_id = :lineid ");
            //sqlQuery.Append("   and sap_item_cd = :sapitemcd ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterDecimal("stdcycletime", inVo.StdCycleTime);
            sqlParameter.AddParameterInteger("lineitemcycletimeid", inVo.LineItemCycleTimeId);
            sqlParameter.AddParameterString("registrationusercd", trxContext.UserData.UserCode);
            sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime);
            sqlParameter.AddParameterString("factcode", trxContext.UserData.FactoryCode);

            UpdateResultVo outVo = new UpdateResultVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Exemplo n.º 2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldItemVo inVo = (MoldItemVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append(" Update m_mold_item");
            sqlQuery.Append(" Set std_cycle_time = :stdcycletime, ");
            sqlQuery.Append("     model_id = :modelid, ");
            sqlQuery.Append("     drawing_no = :drawingno ");
            sqlQuery.Append(" Where factory_cd = :factcode");
            sqlQuery.Append("   and mold_id = :moldid ");
            sqlQuery.Append("   and global_item_id = :globalitemid ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("moldid", inVo.MoldId);
            sqlParameter.AddParameterInteger("globalitemid", inVo.GlobalItemId);
            sqlParameter.AddParameterDecimal("stdcycletime", inVo.StdCycleTime);
            sqlParameter.AddParameterInteger("modelid", inVo.ModelId);
            sqlParameter.AddParameterString("drawingno", inVo.DrawingNo);


            sqlParameter.AddParameterString("factcode", trxContext.UserData.FactoryCode);

            MoldItemVo outVo = new MoldItemVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Exemplo n.º 3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldItemVo inVo  = (MoldItemVo)arg;
            MoldItemVo outVo = new MoldItemVo();

            // Building SQL
            StringBuilder sql = new StringBuilder();

            sql.Append("Insert into m_mold_item");
            sql.Append("(");
            sql.Append(" mold_id,");
            sql.Append(" global_item_id,");
            sql.Append(" std_cycle_time,");
            sql.Append(" model_id,");
            sql.Append(" drawing_no,");
            sql.Append(" registration_user_cd,");
            sql.Append(" registration_date_time,");
            sql.Append(" factory_cd");
            sql.Append(") values (");
            sql.Append(" :moldid,");
            sql.Append(" :globalitemid,");
            sql.Append(" :stdcycletime,");
            sql.Append(" :modelid,");
            sql.Append(" :drawingno,");
            sql.Append(" :registrationusercd,");
            sql.Append(" :registrationdatetime,");
            sql.Append(" :factrycode ");
            sql.Append(" ) ");
            sql.Append("RETURNING mold_item_id;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("moldid", inVo.MoldId);
            sqlParameter.AddParameterInteger("globalitemid", inVo.GlobalItemId);
            sqlParameter.AddParameterDecimal("stdcycletime", inVo.StdCycleTime);
            sqlParameter.AddParameterInteger("modelid", inVo.ModelId);
            sqlParameter.AddParameterString("drawingno", inVo.DrawingNo);
            sqlParameter.AddParameterString("registrationusercd", trxContext.UserData.UserCode);
            sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime);
            sqlParameter.AddParameterString("factrycode", trxContext.UserData.FactoryCode);

            outVo.AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter);

            return(outVo);
        }
Exemplo n.º 4
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            MoldItemVo inVo  = (MoldItemVo)arg;
            MoldItemVo outVo = new MoldItemVo();

            /// Delete sql
            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append(" Delete From m_mold_item");
            sqlQuery.Append(" Where	global_item_id = :globalitemid ");
            sqlQuery.Append(" and factory_cd = :factorycode ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("globalitemid", inVo.GlobalItemId);

            sqlParameter.AddParameterString("factorycode", trxContext.UserData.FactoryCode);

            MoldItemVo moldItemOutVo = new MoldItemVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            // Building SQL
            StringBuilder sql = new StringBuilder();

            sql.Append("Insert into m_mold_item");
            sql.Append("(");
            sql.Append(" mold_id,");
            sql.Append(" global_item_sap_item_id,");
            sql.Append(" std_cycle_time,");
            sql.Append(" registration_user_cd,");
            sql.Append(" registration_date_time,");
            sql.Append(" factory_cd");
            sql.Append(") values (");
            sql.Append(" :moldid,");
            sql.Append(" :globalitemsapitemid,");
            sql.Append(" :stdcycletime,");
            sql.Append(" :registrationusercd,");
            sql.Append(" :registrationdatetime,");
            sql.Append(" :factrycode ");
            sql.Append(" ) ");
            sql.Append("RETURNING mold_item_id;");

            foreach (MoldItemVo curVo in inVo.MoldItemListVo)
            {
                //create command
                sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

                //create parameter
                sqlParameter = sqlCommandAdapter.CreateParameterList();
                sqlParameter.AddParameterInteger("moldid", curVo.MoldId);
                sqlParameter.AddParameterInteger("globalitemsapitemid", inVo.GlobalLocalItemId);
                sqlParameter.AddParameterDecimal("stdcycletime", curVo.StdCycleTime);
                sqlParameter.AddParameterString("registrationusercd", trxContext.UserData.UserCode);
                sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime);
                sqlParameter.AddParameterString("factrycode", trxContext.UserData.FactoryCode);

                //outVo.AffectedCount = (int?)sqlCommandAdapter.ExecuteScalar(sqlParameter) ?? 0;
                outVo.AffectedCount += sqlCommandAdapter.ExecuteNonQuery(sqlParameter);
            }

            return(outVo);
        }