Ejemplo n.º 1
0
        public C_SKU_DETAIL GetDataObject()
        {
            C_SKU_DETAIL DataObject = new C_SKU_DETAIL();

            DataObject.SKUNO         = this.SKUNO;
            DataObject.CATEGORY      = this.CATEGORY;
            DataObject.CATEGORY_NAME = this.CATEGORY_NAME;
            DataObject.VALUE         = this.VALUE;
            DataObject.EXTEND        = this.EXTEND;
            DataObject.VERSION       = this.VERSION;
            DataObject.BASETEMPLATE  = this.BASETEMPLATE;
            DataObject.EDIT_EMP      = this.EDIT_EMP;
            DataObject.EDIT_TIME     = this.EDIT_TIME;
            DataObject.ID            = this.ID;
            return(DataObject);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加或者更新一個 C_SKU_DETAIL 記錄
        /// 需要傳遞一個完完整整的 C_SKU_DETAIL 對象,包括 ID
        /// </summary>
        /// <param name="SkuDetail"></param>
        /// <param name="Bu"></param>
        /// <param name="DB"></param>
        /// <returns></returns>
        public int AddOrUpdateSkuDetail(string Operation, C_SKU_DETAIL SkuDetail, OleExec DB)
        {
            Row_C_SKU_DETAIL SkuDetailRow = (Row_C_SKU_DETAIL)NewRow();
            string           sql          = string.Empty;
            int result = 0;

            if (this.DBType.Equals(DB_TYPE_ENUM.Oracle))
            {
                if (SkuDetail != null && SkuDetail.ID != null)
                {
                    switch (Operation.Trim().ToUpper())
                    {
                    case "ADD":
                        SkuDetailRow = (Row_C_SKU_DETAIL)ConstructRow(SkuDetail);
                        sql          = SkuDetailRow.GetInsertString(this.DBType);
                        break;

                    case "UPDATE":
                        SkuDetailRow               = (Row_C_SKU_DETAIL)GetObjByID(SkuDetail.ID, DB);
                        SkuDetailRow.SKUNO         = SkuDetailRow.SKUNO;
                        SkuDetailRow.CATEGORY      = SkuDetail.CATEGORY;
                        SkuDetailRow.CATEGORY_NAME = SkuDetail.CATEGORY_NAME;
                        SkuDetailRow.VALUE         = SkuDetail.VALUE;
                        SkuDetailRow.EXTEND        = SkuDetail.EXTEND;
                        SkuDetailRow.VERSION       = SkuDetail.VERSION;
                        SkuDetailRow.BASETEMPLATE  = SkuDetail.BASETEMPLATE;
                        SkuDetailRow.EDIT_EMP      = SkuDetail.EDIT_EMP;
                        SkuDetailRow.EDIT_TIME     = SkuDetail.EDIT_TIME;
                        sql = SkuDetailRow.GetUpdateString(this.DBType);
                        break;
                    }

                    result = DB.ExecSqlNoReturn(sql, null);
                }
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() });
                throw new MESReturnMessage(errMsg);
            }
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根據料號,類別,類別具體項目來獲得設置在 C_SKU_DETAIL 裡面的值
        /// </summary>
        /// <param name="Category"></param>
        /// <param name="CategoryName"></param>
        /// <param name="Skuno"></param>
        /// <param name="DB"></param>
        /// <returns></returns>
        public C_SKU_DETAIL GetSkuDetail(string Category, string CategoryName, string Skuno, OleExec DB)
        {
            C_SKU_DETAIL     SkuDetail    = null;
            string           sql          = string.Empty;
            DataTable        dt           = new DataTable();
            Row_C_SKU_DETAIL SkuDetailRow = (Row_C_SKU_DETAIL)NewRow();

            if (this.DBType.Equals(DB_TYPE_ENUM.Oracle))
            {
                sql = $@"SELECT * FROM C_SKU_DETAIL WHERE SKUNO='{Skuno}' AND CATEGORY='{Category}' AND CATEGORY_NAME='{CategoryName}'";
                dt  = DB.ExecSelect(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    SkuDetailRow.loadData(dt.Rows[0]);
                    SkuDetail = SkuDetailRow.GetDataObject();
                }
            }
            else
            {
                string errMsg = MESReturnMessage.GetMESReturnMessage("MES00000019", new string[] { DBType.ToString() });
                throw new MESReturnMessage(errMsg);
            }
            return(SkuDetail);
        }