Пример #1
0
        /// <summary>
        /// 获取批次最后一笔操作记录。
        /// </summary>
        /// <param name="lotNumber">批次号。</param>
        /// <returns>包含批次最后一笔操作记录的数据集对象。</returns>
        public DataSet GetLotLastestActivity(string lotNumber)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"SELECT TOP 1 b.LOT_NUMBER,b.CREATE_OPERTION_NAME,b.FACTORYROOM_KEY,b.PALLET_NO,b.EDIT_TIME LOT_EDIT_TIME,
                                                    a.*
                                            FROM WIP_TRANSACTION a
                                            INNER JOIN POR_LOT b ON a.PIECE_KEY=b.LOT_KEY
                                            WHERE b.LOT_NUMBER='{0}'
                                            AND a.UNDO_FLAG=0
                                            AND a.ACTIVITY IN ('CREATELOT','TRACKIN','TRACKOUT',
                                                               'DEFECT','SCRAP','ADJUST',
                                                               'HOLD','RELEASE','REWORK','CHANGE_WO','CHANGE_PROID',
                                                               'PATCH','PATCHED','CELLSCRAP',
                                                               'CELLDEFECT','TERMINALLOT','RETURN_MATERIAL','TO_WAREHOUSE')
                                            ORDER BY TIME_STAMP DESC",
                                           lotNumber.PreventSQLInjection());
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
            }
            return(dsReturn);
        }
Пример #2
0
        /// <summary>
        /// 根据分组名称和类型获取原因代码。
        /// </summary>
        /// <param name="categoryName">分组名称。</param>
        /// <param name="type">类型。</param>
        /// <returns>包含原因代码数据的数据集。</returns>
        private DataSet GetReasonCodeByCategoryName(string categoryName, string type)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"SELECT  A.REASON_CODE_NAME,A.REASON_CODE_KEY
                                            FROM FMM_REASON_CODE     A,
                                                 FMM_REASON_CODE_CATEGORY B,
                                                 FMM_REASON_R_CATEGORY    C
                                            WHERE A.REASON_CODE_KEY = C.REASON_CODE_KEY
                                            AND B.REASON_CODE_CATEGORY_KEY = C.CATEGORY_KEY
                                            AND A.REASON_CODE_TYPE='{1}'
                                            AND B.REASON_CODE_CATEGORY_NAME = '{0}'",
                                           categoryName.PreventSQLInjection(),
                                           type.PreventSQLInjection());
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetReasonCodeByCategoryName Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #3
0
        /// <summary>
        /// 根据厂别获取组件录入卡控信息。
        /// </summary>
        /// <param name="sFactoryName">批次主键。</param>
        /// <returns>
        /// 包含组件录入卡控信息的数据集。
        /// </returns>
        public DataSet GetCheckbarcodeInputType(string sFactoryName)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = "SELECT A.* ";
                sql += " FROM (SELECT T.ITEM_ORDER,";
                sql += "MAX( case T.ATTRIBUTE_NAME when 'IsCheckBarcodeInput' THEN T.ATTRIBUTE_VALUE ELSE ''  end ) as 'IsCheckBarcodeInput',";
                sql += "MAX( case T.ATTRIBUTE_NAME when 'FactoryName' THEN T.ATTRIBUTE_VALUE ELSE ''  end ) as 'FactoryName'";
                sql += " FROM CRM_ATTRIBUTE T,BASE_ATTRIBUTE T1,BASE_ATTRIBUTE_CATEGORY T2";
                sql += " WHERE T.ATTRIBUTE_KEY = T1.ATTRIBUTE_KEY AND T1.CATEGORY_KEY = T2.CATEGORY_KEY";
                sql += " AND UPPER(T2.CATEGORY_NAME) = 'Basic_CheckBarcode_InputType'";
                sql += " GROUP BY T.ITEM_ORDER) A";
                sql += " WHERE 1=1";
                if (!string.IsNullOrEmpty(sFactoryName))
                {
                    sql += " AND A.FactoryName='" + sFactoryName + "'";
                }
                sql += " ORDER BY A.ITEM_ORDER ASC";

                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetCheckbarcodeInputType Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #4
0
        /// <summary>
        /// 根据原因代码分类主键获取原因代码数据。
        /// </summary>
        /// <param name="categoryKey">原因代码分类主键。</param>
        /// <returns>
        /// 包含原因代码数据的数据集对象。
        /// </returns>
        public DataSet GetReasonCategory(string categoryKey)
        {
            DataSet dsReturn   = new DataSet();
            string  sqlCommond = string.Empty;

            try
            {
                if (categoryKey != string.Empty)
                {
                    sqlCommond = string.Format(@"SELECT a.REASON_CODE_KEY,a.REASON_CODE_NAME,a.REASON_CODE_CLASS
                                               FROM FMM_REASON_CODE a
                                               WHERE EXISTS (SELECT 1
                                                             FROM FMM_REASON_R_CATEGORY
                                                             WHERE CATEGORY_KEY = '{0}'
                                                             AND REASON_CODE_KEY=a.REASON_CODE_KEY) 
                                               ORDER BY a.REASON_CODE_NAME", categoryKey.PreventSQLInjection());
                }
                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommond);
                dsReturn.Tables[0].TableName = FMM_REASON_CODE_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetReasonCategory Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #5
0
        public DataSet GetProductDtlGrade(string proid)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sqlCommand = string.Format(@"SELECT t.PRODUCT_CODE,t1.ISMAIN,t1.PRODUCT_GRADE
                                                FROM POR_PRODUCT t 
                                                INNER JOIN POR_PRODUCT_DTL t1 ON t.PRODUCT_KEY=t1.PRODUCT_KEY
                                                WHERE t.ISFLAG=1 and t1.ISFLAG=1
                                                AND t.PRODUCT_CODE='{0}'
                                                AND t1.ISMAIN=1",
                                                  proid.PreventSQLInjection());

                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommand);
                dsReturn.Tables[0].TableName = POR_PRODUCT.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetProductDtlGrade Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #6
0
        /// <summary>
        /// 获取待补片的生产批次(排除组件补片批次)信息。
        /// </summary>
        /// <remarks>
        /// <see cref="POR_LOT_FIELDS.FIELD_LOT_TYPE"/>
        /// </remarks>
        /// <param name="workorderNo">工单号。</param>
        /// <param name="proId">产品ID号。</param>
        /// <param name="efficiency">转换效率。</param>
        /// <returns>包含待补片批次信息的数据集对象。</returns>
        public DataSet GetPatchedLotNumber(string workorderNo, string proId, string efficiency)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"SELECT LOT_KEY,LOT_NUMBER,WORK_ORDER_NO,PRO_ID,EFFICIENCY,QUANTITY_INITIAL,QUANTITY,ROUTE_ENTERPRISE_VER_KEY,CUR_ROUTE_VER_KEY,CUR_STEP_VER_KEY,EDIT_TIME
                                            FROM POR_LOT
                                            WHERE WORK_ORDER_NO='{0}' AND PRO_ID='{1}' AND EFFICIENCY='{2}'
                                            AND {3}='{4}'
                                            AND DELETED_TERM_FLAG=0",
                                           workorderNo.PreventSQLInjection(),
                                           proId.PreventSQLInjection(),
                                           efficiency.PreventSQLInjection(),
                                           POR_LOT_FIELDS.FIELD_LOT_TYPE,
                                           "N");
                //执行查询。
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetPatchedLotNumber Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #7
0
        public DataSet GetLotExceptionData(string lotNo, string sTime, string eTime)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"Select * from POR_LOT_EXCEPTION where 1=1");

                if (lotNo != "")
                {
                    sql += string.Format(@" and LOT_NUMBER='{0}'", lotNo);
                }
                if (sTime != "" && eTime != "")
                {
                    sql += string.Format(@" and CREATE_DATE between '{0}' and '{1}'", sTime, eTime);
                }
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql.ToString());
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetLotExceptionData Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #8
0
        /// <summary>
        /// 获取原因代码数据。
        /// </summary>
        /// <param name="type">
        /// 原因代码类型。
        /// </param>
        /// <param name="name">
        /// 原因代码名称。
        /// </param>
        /// <param name="rcClass">
        /// 原因代码分类。
        /// </param>
        /// <returns>
        /// 包含原因代码数据的数据集对象。
        /// </returns>
        public DataSet GetReasonCode(string type, string name, string rcClass)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"SELECT * FROM FMM_REASON_CODE 
                                   WHERE REASON_CODE_TYPE = '{0}' 
                                   AND REASON_CODE_NAME = '{1}'
                                   AND REASON_CODE_CLASS='{2}'",
                                   type.PreventSQLInjection(),
                                   name.PreventSQLInjection(),
                                   rcClass.PreventSQLInjection());
                dsReturn = db.ExecuteDataSet(CommandType.Text, sbSql.ToString());
                dsReturn.Tables[0].TableName = FMM_REASON_CODE_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetReasonCode Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #9
0
        /// <summary>
        /// 获取批次暂停信息。
        /// </summary>
        /// <param name="lotNumber">批次号。</param>
        /// <returns>包含批次暂停信息的数据集对象。</returns>
        public DataSet GetLotHoldInfo(string lotNumber)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"SELECT a.*,c.LOT_NUMBER,c.LOT_KEY
                                            FROM WIP_HOLD_RELEASE a
                                            INNER JOIN WIP_TRANSACTION b on a.TRANSACTION_KEY=b.TRANSACTION_KEY
                                            INNER JOIN POR_LOT c ON c.LOT_KEY=b.PIECE_KEY AND b.PIECE_TYPE=0
                                            WHERE b.ACTIVITY='HOLD' 
                                            AND b.UNDO_FLAG=0
                                            AND a.IS_RELEASE=0
                                            AND c.LOT_NUMBER='{0}'
                                            ORDER BY a.EDIT_TIME DESC",
                                           lotNumber.PreventSQLInjection());
                //执行查询。
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetLotHoldInfo Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #10
0
        /// <summary>
        /// 根据原因代码类别主键和原因代码分类获取原因代码。
        /// </summary>
        /// <param name="categoryKey">原因代码分类主键。</param>
        /// <param name="codeClass">原因代码分类。</param>
        /// <returns>包含原因代码数据的数据集对象。</returns>
        public DataSet GetReasonCode(string categoryKey, string codeClass)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"SELECT A.REASON_CODE_NAME,A.REASON_CODE_KEY,A.REASON_CODE_TYPE
                                    FROM FMM_REASON_CODE A,FMM_REASON_R_CATEGORY B
                                    WHERE A.REASON_CODE_KEY=B.REASON_CODE_KEY
                                    AND B.CATEGORY_KEY='{0}'",
                                   categoryKey.PreventSQLInjection());
                if (!string.IsNullOrEmpty(codeClass))
                {
                    sbSql.AppendFormat(" AND A.REASON_CODE_CLASS='{0}'", codeClass.PreventSQLInjection());
                }
                sbSql.Append("ORDER BY A.REASON_CODE_CLASS ASC,A.REASON_CODE_TYPE DESC ,B.CODE_INDEX ");
                //执行查询。
                dsReturn = db.ExecuteDataSet(CommandType.Text, sbSql.ToString());
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetReasonCode Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #11
0
        public DataSet GetCarInfo(string _ono)
        {
            if (string.IsNullOrEmpty(_ono) == true)
            {
                return(null);
            }

            DataSet dsReturn = new DataSet();

            try
            {
                StringBuilder sbSql = new StringBuilder();

                sbSql.AppendFormat(@" SELECT CI,ShipmentType,ShipmentNO FROM AWMS_OUTB_HEADER WHERE OUTBANDNO = '" + _ono + "'");
                dsReturn = db.ExecuteDataSet(CommandType.Text, sbSql.ToString());
                dsReturn.Tables[0].TableName = "CarInfo";
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("ImportPickdata Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #12
0
        public DataSet GetQCItem(string VBELN, string POSNR)
        {
            DataSet dsReturn = new DataSet();

            string sql = String.Format(@"select * from AWMS_OUTB_QC where VBELN =  '{0}' and POSNR = '{1}'
                                            ORDER BY ID",
                                       VBELN.PreventSQLInjection(),
                                       POSNR.PreventSQLInjection());

            try
            {
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                if (dsReturn.Tables[0].Rows.Count == 0)
                {
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, "没有查询到相关的质检明细数据!");
                }
                else
                {
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
                }
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("OutDeliveryQuerry Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #13
0
        /// <summary>
        /// 获取不存在于某个类别主键中的原因代码数据。
        /// </summary>
        /// <param name="categoryKey">原因代码类别主键。</param>
        /// <param name="categoryType">原因代码类别类型。</param>
        /// <returns>
        /// 包含原因代码数据的数据集对象。
        /// </returns>
        public DataSet GetReasonCodeNotExistCategory(string categoryKey, string categoryType)
        {
            DataSet dsReturn   = new DataSet();
            string  sqlCommond = string.Empty;

            try
            {
                if (categoryKey != string.Empty)
                {
                    sqlCommond = string.Format(@"SELECT REASON_CODE_KEY, REASON_CODE_NAME,REASON_CODE_CLASS
                                                FROM FMM_REASON_CODE
                                                WHERE REASON_CODE_KEY NOT IN (SELECT DISTINCT REASON_CODE_KEY 
                                                                              FROM FMM_REASON_R_CATEGORY
                                                                              WHERE CATEGORY_KEY = '{0}') 
                                                AND REASON_CODE_TYPE = '{1}'
                                                ORDER BY REASON_CODE_NAME",
                                               categoryKey.PreventSQLInjection(),
                                               categoryType.PreventSQLInjection());
                }

                DataTable dtTable = new DataTable();
                dtTable           = db.ExecuteDataSet(CommandType.Text, sqlCommond).Tables[0];
                dtTable.TableName = FMM_REASON_CODE_FIELDS.DATABASE_TABLE_NAME;
                dsReturn.Merge(dtTable, false, MissingSchemaAction.Add);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetReasonCodeNotExistCategory Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #14
0
        /// <summary>
        /// 查询抬头表
        /// </summary>
        /// <param name="ZMBLNR"></param>
        /// <returns></returns>
        public DataSet QueryWarehouseWarrantHead(string ZMBLNR, string ISSYN, bool isQueryForSyn)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = String.Format(@"SELECT ZMBLNR, WERKS, STATUS, ZMMTYP, AUFNR,
                                                    VBELN_OEM, DEPT, CDATE, CREATOR, ISSYN
                                             FROM DBO.AWMS_WH_ENTRY a
                                             WHERE ZMBLNR LIKE '{0}%' AND STATUS = '正常' ",
                                           ZMBLNR.PreventSQLInjection());
                if (!String.IsNullOrEmpty(ISSYN))
                {
                    sql += @" AND ISSYN = '" + ISSYN + "' ";
                }
                if (isQueryForSyn)
                {
                    sql += @" AND EXISTS (SELECT ORDER_NUMBER FROM DBO.POR_WORK_ORDER  
                                            WHERE ORDER_NUMBER = a.AUFNR AND ORDER_STATE = 'REL')";
                }
                sql     += " ORDER BY CDATE ";
                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("WarehouseWarrant Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #15
0
        /// <summary>
        /// 根据序列号获取金刚线
        /// </summary>
        /// <param name="lotNumber"></param>
        /// <returns></returns>
        public DataSet GetKingLineInf(string lotNumber)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sqlCommand = string.Format(@"SELECT C.PRODUCT_KEY,C.PRODUCT_CODE,C.PRODUCT_NAME,C.ISKINGLING,D.* FROM POR_PRODUCT C INNER JOIN (
                                                            SELECT A.LOT_KEY,A.LOT_NUMBER,A.WORK_ORDER_KEY,WORK_ORDER_NO,B.PRODUCT_CODE,B.PRODUCT_KEY FROM POR_LOT A 
                                                            INNER JOIN dbo.POR_WO_PRD B ON A.WORK_ORDER_KEY = B.WORK_ORDER_KEY
                                                            AND DELETED_TERM_FLAG = 0
                                                            AND LOT_NUMBER = '{0}'
                                                            AND IS_USED = 'Y'
                                                            AND IS_MAIN ='Y') D
                                                            ON C.PRODUCT_KEY = D.PRODUCT_KEY
                                                            WHERE C.ISFLAG = 1 
                                                            ",
                                                  lotNumber.PreventSQLInjection());

                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommand);
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetKingLineInf Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #16
0
        /// <summary>
        /// 检查选定的线别是否为组件允许过站的线别
        /// </summary>
        /// <param name="lotLineKey">绑定的线别主键</param>
        /// <param name="curLineKey">当前的线别主键</param>
        /// <param name="curOperationName">当前工序名称</param>
        /// <returns>操作结果</returns>
        public DataSet CheckLotLine(string lotLineKey, string curLineKey, string curOperationName)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sqlCommand = string.Format(@"
                                                    SELECT * FROM FMM_PRODUCTION_LINE_SUB
                                                    WHERE PRODUCTION_LINE_KEY = '{0}'
                                                    AND PRODUCTION_LINE_SUB_KEY = '{1}'
                                                    AND OPERATION_NAME = '{2}'",
                                                  lotLineKey,
                                                  curLineKey,
                                                  curOperationName);

                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommand);
                dsReturn.Tables[0].TableName = FMM_PRODUCTION_LINE_SUB_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("CheckLotLine Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #17
0
        /// <summary>
        /// 通过用户获取对应有权限的工序信息
        /// </summary>
        /// <param name="userName">用户帐号</param>
        /// <param name="LineName">工序名称</param>
        /// <returns>用户拥有权限的工序表集</returns>
        public DataSet GetOperationByUserNameAndOperationName(string userName, string operationName)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sqlCommand = string.Format(@"SELECT C.OPERATION_NAME
                                                    FROM RBAC_USER A
                                                    INNER JOIN RBAC_USER_IN_ROLE B ON B.USER_KEY = A.USER_KEY
                                                    INNER JOIN RBAC_ROLE_OWN_OPERATION C ON C.ROLE_KEY = B.ROLE_KEY
                                                    WHERE USERNAME = '******'
                                                    ", userName);

                if (!string.IsNullOrEmpty(operationName))
                {
                    sqlCommand = sqlCommand + string.Format("AND C.OPERATION_NAME LIKE '%{0}%'", operationName);
                }

                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommand);
                dsReturn.Tables[0].TableName = RBAC_ROLE_OWN_OPERATION_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetLineByUser Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #18
0
        /// <summary>
        /// 通过用户获取对应有权限的线别信息
        /// </summary>
        /// <param name="userName">用户帐号</param>
        /// <param name="LineName">线别名称</param>
        /// <returns>用户拥有权限的线别表集</returns>
        public DataSet GetLineByUserNameAndLineName(string userName, string lineName)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sqlCommand = string.Format(@"SELECT DISTINCT D.PRODUCTION_LINE_KEY,D.LINE_NAME,D.LINE_CODE,D.DESCRIPTIONS
                                                    FROM RBAC_USER A
                                                    INNER JOIN RBAC_USER_IN_ROLE B ON B.USER_KEY = A.USER_KEY
                                                    INNER JOIN RBAC_ROLE_OWN_LINES C ON C.ROLE_KEY = B.ROLE_KEY
                                                    INNER JOIN FMM_PRODUCTION_LINE D ON D.LINE_NAME = C.LINE_NAME
                                                    WHERE USERNAME = '******'
                                                    ", userName);

                if (!string.IsNullOrEmpty(lineName))
                {
                    sqlCommand = sqlCommand + string.Format("AND D.LINE_NAME LIKE '%{0}%'", lineName);
                }

                dsReturn = db.ExecuteDataSet(CommandType.Text, sqlCommand);
                dsReturn.Tables[0].TableName = FMM_PRODUCTION_LINE_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetLineByUser Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #19
0
        /// <summary>
        /// 获取组件对应的工艺流程中组件所在工序的属性信息
        /// </summary>
        /// <param name="lotNo">批次号</param>
        /// <returns>工序对应的属性信息</returns>
        public DataSet GetLotRouteAttrData(string lotNo)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Empty;

                sql = string.Format(@"DECLARE @routeKey  VARCHAR(MAX);

                                      SET @routeKey = (SELECT CUR_STEP_VER_KEY 
				                                       FROM POR_LOT
				                                       WHERE LOT_NUMBER = '{0}'
                                                       AND STATUS<2);
                                                     
                                      SELECT ATTRIBUTE_NAME,ATTRIBUTE_VALUE 
                                      FROM POR_ROUTE_STEP_ATTR 
                                      WHERE ROUTE_STEP_KEY = @routeKey;",
                                    lotNo.PreventSQLInjection());

                DataTable dtLotRouteAttrData = db.ExecuteDataSet(CommandType.Text, sql).Tables[0];
                dtLotRouteAttrData.TableName = "LOT_ROUTE_ATTR";
                dsReturn.Merge(dtLotRouteAttrData, true, MissingSchemaAction.Add);

                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("LotOperationEngine.GetLotRouteAttrData Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #20
0
        /// <summary>
        /// 根据工序主键获取工序数据。
        /// </summary>
        /// <param name="operationKey">工序主键。</param>
        /// <returns>包含工序数据的数据集对象。</returns>
        public DataSet GetOperationByKey(string operationKey)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                if (!string.IsNullOrEmpty(operationKey))
                {
                    //获取工序自定义属性
                    string sqlCommand = string.Format(@"SELECT A.*, B.DATA_TYPE
                                                      FROM POR_ROUTE_OPERATION_ATTR A
                                                      LEFT JOIN BASE_ATTRIBUTE B ON A.ATTRIBUTE_KEY = B.ATTRIBUTE_KEY
                                                      WHERE ROUTE_OPERATION_VER_KEY = '{0}'
                                                      ORDER BY 1",
                                                      operationKey.PreventSQLInjection());
                    DataTable dtUDAs = new DataTable();
                    dtUDAs           = db.ExecuteDataSet(CommandType.Text, sqlCommand).Tables[0];
                    dtUDAs.TableName = POR_ROUTE_OPERATION_ATTR_FIELDS.DATABASE_TABLE_NAME;
                    dsReturn.Merge(dtUDAs, false, MissingSchemaAction.Add);
                    //获取工序参数。
                    sqlCommand = string.Format(@"SELECT A.*
                                              FROM POR_ROUTE_OPERATION_PARAM A
                                              WHERE ROUTE_OPERATION_VER_KEY = '{0}'
                                              AND IS_DELETED=0
                                              ORDER BY PARAM_INDEX",
                                               operationKey.PreventSQLInjection());
                    DataTable dtParams = new DataTable();
                    dtParams           = db.ExecuteDataSet(CommandType.Text, sqlCommand).Tables[0];
                    dtParams.TableName = POR_ROUTE_OPERATION_PARAM_FIELDS.DATABASE_TABLE_NAME;
                    dsReturn.Merge(dtParams, false, MissingSchemaAction.Add);
                    //获取工序数据
                    sqlCommand = string.Format(@"SELECT A.*,
                                                        D.REASON_CODE_CATEGORY_NAME AS SCRAP_REASON_CODE_CATEGORY_NAME, 
                                                        E.REASON_CODE_CATEGORY_NAME AS DEFECT_REASON_CODE_CATEGORY_NAME
                                                FROM POR_ROUTE_OPERATION_VER A
                                                LEFT JOIN FMM_REASON_CODE_CATEGORY D ON D.REASON_CODE_CATEGORY_KEY = A.SCRAP_REASON_CODE_CATEGORY_KEY
                                                LEFT JOIN FMM_REASON_CODE_CATEGORY E ON E.REASON_CODE_CATEGORY_KEY = A.DEFECT_REASON_CODE_CATEGORY_KEY
                                                WHERE A.ROUTE_OPERATION_VER_KEY = '{0}'
                                                ORDER BY 1", operationKey.PreventSQLInjection());
                    DataTable dtMain = new DataTable();
                    dtMain           = db.ExecuteDataSet(CommandType.Text, sqlCommand).Tables[0];
                    dtMain.TableName = POR_ROUTE_OPERATION_VER_FIELDS.DATABASE_TABLE_NAME;
                    dsReturn.Merge(dtMain, false, MissingSchemaAction.Add);
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
                }
                else
                {
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, "${res:Global.ServerMessage.M0006}");
                }
            }
            catch (Exception ex)
            {
                FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetOperationByKey Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #21
0
        /// <summary>
        /// 根据托盘号和批次号获取返工数据。
        /// </summary>
        /// <remarks>
        /// 只输入托盘号,根据托盘号获取返工明细数据。
        /// 只输入批次号,根据批次号获取返工明细数据。
        /// 同时输入托盘号和批次号,获取返工明细数据。
        /// </remarks>
        /// <returns>包含返工明细数据的数据集对象。</returns>
        public DataSet GetExchangeData(string packageNo, string lotNo)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"SELECT ROW_NUMBER() OVER(ORDER BY t.LOT_NUMBER) SEQ,
                                               t.LOT_KEY,
                                               t.LOT_NUMBER,
                                               t.WORK_ORDER_NO,
                                               t.PRO_ID,
                                               t.PALLET_NO,
                                               t.PALLET_TIME,
                                               t.PART_NUMBER,
                                               t.LOT_SIDECODE,
                                               t.LOT_CUSTOMERCODE,
                                               t.COLOR,
                                               t.EDIT_TIME,
                                               t.PRO_LEVEL,
                                               t.STATE_FLAG,
                                               t.FACTORYROOM_KEY,
                                               t.HOLD_FLAG,
                                               t.FACTORYROOM_NAME,
                                               b.GRADE_NAME,
                                               a.DEVICENUM,a.VC_DEFAULT,a.T_DATE,a.VC_TYPE,a.I_IDE,a.VC_MODNAME,a.I_PKID,
                                               a.PM,a.FF,a.IPM,a.ISC,a.VPM,a.VOC,
                                               a.COEF_PMAX,a.COEF_FF,a.COEF_IMAX,a.COEF_ISC,a.COEF_VMAX,a.COEF_VOC
                                        FROM POR_LOT t 
                                        LEFT JOIN WIP_IV_TEST a ON a.LOT_NUM=t.LOT_NUMBER AND a.VC_DEFAULT=1
                                        LEFT JOIN V_ProductGrade b ON b.GRADE_CODE=t.PRO_LEVEL
                                        WHERE t.DELETED_TERM_FLAG<2");

                if (!string.IsNullOrEmpty(packageNo))
                {
                    sbSql.AppendFormat("AND t.PALLET_NO='{0}'", packageNo.PreventSQLInjection());
                }
                if (!string.IsNullOrEmpty(lotNo))
                {
                    sbSql.AppendFormat("AND t.LOT_NUMBER='{0}'", lotNo.PreventSQLInjection());
                }

                DataTable dtExchangeDetail = db.ExecuteDataSet(CommandType.Text, sbSql.ToString()).Tables[0];
                dtExchangeDetail.TableName = POR_LOT_FIELDS.DATABASE_TABLE_NAME;
                dsReturn.Merge(dtExchangeDetail, true, MissingSchemaAction.Add);

                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("LotOperationEngine.GetExchangeData Error: " + ex.Message);
            }

            return(dsReturn);
        }
Пример #22
0
        public DataSet ImportPickdata(string _outbandno)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                StringBuilder sbSql = new StringBuilder();
                sbSql.AppendFormat(@"
                                    SELECT 
                                    REF_NO AS DOCUMENT_NUMB ,                                    
                                    REF_ITEM AS DOCUMENT_ITEM,
                                    POSNR,
                                    PLANT, 
                                    STORAGELOCATION AS STGE_LOC,                                    
                                    VSTEL AS LOADINGGRP,
                                    OBDQTY AS QUANTITY_SALES_UOM,
                                    CONVERT(VARCHAR,GETDATE(),112) AS DATE_USAGE,
                                    CONVERT(VARCHAR,GETDATE(),112) AS DATE,
                                    CONVERT(VARCHAR,GETDATE(),112) AS GOODS_ISSUE_DATE,
                                    CONVERT(VARCHAR,GETDATE(),112) AS LOADING_DATE,
                                    CONVERT(VARCHAR,GETDATE(),112) AS DELIVERY_DATE,
                                    CONVERT(VARCHAR,GETDATE(),108) AS TIME,
                                    UNIT AS SALES_UNIT,
                                    BATCHNO  AS BATCH 
                                    FROM AWMS_OUTB_ITEM WITH(NOLOCK)
                                    WHERE STATUS='保存'
                                    AND OUTBANDNO = '{0}'
                                    
                                    SELECT 
                                    * 
                                    FROM AWMS_OUTB_HEADER 
                                    WHERE STATUS='保存'
                                    AND OUTBANDNO = '{1}'
                                    
                                    SELECT TOP 1 *  FROM AWMS_CONTAINER WITH(NOLOCK) WHERE CONTAINER_KEY IN 
                                    ( SELECT DISTINCT Cabinet_KEY FROM AWMS_OUTB_ITEM WITH(NOLOCK)   WHERE OUTBANDNO = '{2}' AND STATUS='保存' )
                                    AND STATUS <> 0 
                                    ",
                                   _outbandno.PreventSQLInjection(),
                                   _outbandno.PreventSQLInjection(),
                                   _outbandno.PreventSQLInjection());
                //执行查询。
                dsReturn = db.ExecuteDataSet(CommandType.Text, sbSql.ToString());
                dsReturn.Tables[0].TableName = "REQUEST";
                dsReturn.Tables[1].TableName = "HEADER";
                dsReturn.Tables[2].TableName = "CK_CONTAINER";

                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("ImportPickdata Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #23
0
        /// <summary>
        /// 终止批次操作,根据操作名称(<see cref="WIP_TRANSACTION_FIELDS.FIELD_ACTIVITY"/>)区分。
        /// </summary>
        /// <remarks>
        /// 操作名称:<see cref="ACTIVITY_FIELD_VALUES.FIELD_ACTIVITY_TERMINALLOT"/>。
        /// </remarks>
        /// <param name="dsParams">包含终止批次信息的数据集对象。</param>
        /// <returns>包含结果数据的数据集对象。</returns>
        public DataSet LotTerminal(DataSet dsParams)
        {
            DataSet       dsReturn = new DataSet();
            DbConnection  dbConn   = null;
            DbTransaction dbTran   = null;

            try
            {
                dbConn = db.CreateConnection();
                dbConn.Open();
                dbTran = dbConn.BeginTransaction();
                //参数数据。
                if (dsParams == null ||
                    !dsParams.Tables.Contains(TRANS_TABLES.TABLE_PARAM) ||                              //存放附加参数数据
                    !dsParams.Tables.Contains(WIP_TRANSACTION_FIELDS.DATABASE_TABLE_NAME)               //存放操作数据
                    | dsParams.Tables[WIP_TRANSACTION_FIELDS.DATABASE_TABLE_NAME].Rows.Count == 0)
                {
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, "传入参数不正确,请检查。");
                    return(dsReturn);
                }
                DataTable dtParams      = dsParams.Tables[TRANS_TABLES.TABLE_PARAM];                    //存放附加参数数据
                DataTable dtTransaction = dsParams.Tables[WIP_TRANSACTION_FIELDS.DATABASE_TABLE_NAME];  //存放操作数据
                Hashtable htTransaction = FanHai.Hemera.Share.Common.CommonUtils.ConvertToHashtable(dtTransaction);
                Hashtable htParams      = FanHai.Hemera.Share.Common.CommonUtils.ConvertToHashtable(dtParams);
                string    opEditTime    = Convert.ToString(htParams[COMMON_FIELDS.FIELD_COMMON_EDIT_TIME]); //操作时编辑时间
                string    lotKey        = Convert.ToString(htTransaction[WIP_TRANSACTION_FIELDS.FIELD_PIECE_KEY]);
                string    editTimeZone  = Convert.ToString(htTransaction[WIP_TRANSACTION_FIELDS.FIELD_EDIT_TIMEZONE_KEY]);
                string    editor        = Convert.ToString(htTransaction[WIP_TRANSACTION_FIELDS.FIELD_EDITOR]);
                string    activity      = Convert.ToString(htTransaction[WIP_TRANSACTION_FIELDS.FIELD_ACTIVITY]);
                //检查记录是否过期。防止重复修改。
                KeyValuePair <string, string>         kvp           = new KeyValuePair <string, string>(POR_LOT_FIELDS.FIELD_LOT_KEY, lotKey);
                List <KeyValuePair <string, string> > listCondition = new List <KeyValuePair <string, string> >();
                listCondition.Add(kvp);
                //如果记录过期,当前编辑时间<数据库中的记录编辑时间。结束方法执行。
                if (UtilHelper.CheckRecordExpired(db, POR_LOT_FIELDS.DATABASE_TABLE_NAME, listCondition, opEditTime))
                {
                    ReturnMessageUtils.AddServerReturnMessage(dsReturn, COMMON_FIELDS.FIELD_COMMON_EDITTIME_EXP);
                    return(dsReturn);
                }
                LotTerminal(dsParams, dbTran);
                dbTran.Commit();
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("LotDefect Error: " + ex.Message);
                dbTran.Rollback();
            }
            finally
            {
                dbConn.Close();
            }
            return(dsReturn);
        }
Пример #24
0
        /// <summary>
        /// 根据批次号获取批次信息。
        /// </summary>
        /// <param name="lotNo">批次号或批次主键。</param>
        /// <returns>
        /// 包含批次信息的数据集。
        /// </returns>
        public DataSet GetLotInfo(string lotNo)
        {
            DataSet dsReturn = new DataSet();
            string  sql      = @"SELECT TOP 1  A.[LOT_KEY],A.[LOT_NUMBER],A.[WORK_ORDER_KEY],A.[WORK_ORDER_NO],A.[WORK_ORDER_SEQ]
                                ,A.[PART_VER_KEY],A.[PART_NUMBER],A.[PRO_ID],A.[PRO_LEVEL],A.[PRIORITY],A.[QUANTITY_INITIAL]
                                ,A.[LOT_LINE_CODE],A.[LOT_LINE_KEY]
                                ,A.[QUANTITY],A.[ROUTE_ENTERPRISE_VER_KEY],A.[CUR_ROUTE_VER_KEY],A.[CUR_STEP_VER_KEY]
                                ,A.[CUR_PRODUCTION_LINE_KEY],A.[LINE_NAME],A.[START_WAIT_TIME],A.[START_PROCESS_TIME]
                                ,A.[EDC_INS_KEY],A.[STATE_FLAG],A.[IS_MAIN_LOT],A.[SPLIT_FLAG],A.[LOT_SEQ],A.[REWORK_FLAG]
                                ,A.[HOLD_FLAG],A.[SHIPPED_FLAG],A.[DELETED_TERM_FLAG],A.[IS_PRINT],A.[LOT_TYPE],A.[CREATE_TYPE]
                                ,A.[COLOR],A.[PALLET_NO],A.[PALLET_TIME],A.[STATUS],A.[OPERATOR],A.[OPR_LINE],A.[OPR_COMPUTER]
                                ,A.[OPR_LINE_PRE],A.[CHILD_LINE],A.[MATERIAL_CODE],A.[MATERIAL_LOT],A.[SUPPLIER_NAME],A.[SI_LOT]
                                ,A.[EFFICIENCY],A.[FACTORYROOM_KEY],A.[FACTORYROOM_NAME],A.[CREATE_OPERTION_NAME],A.[CREATOR]
                                ,A.[CREATE_TIME],A.[CREATE_TIMEZONE_KEY],A.[EDITOR],A.[EDIT_TIME],A.[EDIT_TIMEZONE],A.[SHIFT_NAME]
                                ,A.[DESCRIPTIONS],A.[LOT_SIDECODE],A.[LOT_CUSTOMERCODE],A.ORG_WORK_ORDER_NO,
                            B.ENTERPRISE_NAME,
                            B.ENTERPRISE_VERSION,
                            C.ROUTE_NAME ,
                            D.ROUTE_STEP_NAME,
                            (SELECT TOP 1 EQUIPMENT_KEY 
                                 FROM EMS_LOT_EQUIPMENT 
                                 WHERE LOT_KEY=A.LOT_KEY
                                 AND STEP_KEY=A.CUR_STEP_VER_KEY
                                 AND END_TIMESTAMP IS NULL) AS EQUIPMENT_KEY,
                                 
                               (SELECT EQUIPMENT_NAME
                                FROM EMS_EQUIPMENTS
                                WHERE EQUIPMENT_KEY=(SELECT TOP 1 EQUIPMENT_KEY 
                                                    FROM EMS_LOT_EQUIPMENT 
                                                    WHERE LOT_KEY=A.LOT_KEY
                                                    AND STEP_KEY=A.CUR_STEP_VER_KEY
                                                    AND END_TIMESTAMP IS NULL)) AS EQUIPMENT_NAME
                        FROM POR_LOT A
                        LEFT JOIN POR_ROUTE_ENTERPRISE_VER B ON B.ROUTE_ENTERPRISE_VER_KEY=  A.ROUTE_ENTERPRISE_VER_KEY
                        LEFT JOIN POR_ROUTE_ROUTE_VER C ON C.ROUTE_ROUTE_VER_KEY=A.CUR_ROUTE_VER_KEY
                        LEFT JOIN POR_ROUTE_STEP D ON D.ROUTE_STEP_KEY=A.CUR_STEP_VER_KEY
                        WHERE A.STATUS<> 2 
                        AND (A.LOT_NUMBER='{0}' OR A.LOT_KEY='{0}')";

            try
            {
                dsReturn = db.ExecuteDataSet(CommandType.Text, string.Format(sql, lotNo.PreventSQLInjection()));
                dsReturn.Tables[0].Columns[POR_LOT_FIELDS.FIELD_START_WAIT_TIME].DateTimeMode    = DataSetDateTime.Unspecified;
                dsReturn.Tables[0].Columns[POR_LOT_FIELDS.FIELD_START_PROCESS_TIME].DateTimeMode = DataSetDateTime.Unspecified;
                dsReturn.Tables[0].Columns[POR_LOT_FIELDS.FIELD_EDIT_TIME].DateTimeMode          = DataSetDateTime.Unspecified;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetLotInfo Error: " + ex.Message);
            }
            //返回结果集。
            return(dsReturn);
        }
Пример #25
0
        /// <summary>
        /// 查询在线物料明细信息。
        /// </summary>
        /// <param name="model">
        /// 包含查询条件对象。
        /// </param>
        /// <param name="storeMaterialKey">
        /// 在线物料主键
        /// </param>
        /// <returns>包含在线物料信息的数据集。</returns>
        public DataSet QueryDetail(OnlineMaterialQueryModel model, string storeMaterialKey)
        {
            DataSet       dsReturn = new DataSet();
            StringBuilder sbSql    = new StringBuilder();

            try
            {
                sbSql.Append(@"SELECT A.STORE_MATERIAL_KEY,
                                     A.MATERIAL_LOT,
                                     A.CURRENT_QTY,
                                     A.MATERIAL_SUPPLIER,
                                     D.UNIT
                            FROM WST_STORE_MATERIAL_DETAIL A 
                            LEFT JOIN WST_STORE_MATERIAL B ON A.STORE_MATERIAL_KEY=B.STORE_MATERIAL_KEY
                            LEFT JOIN WST_STORE C ON B.STORE_KEY=C.STORE_KEY
                            LEFT JOIN POR_MATERIAL D ON B.MATERIAL_KEY=D.MATERIAL_KEY
                            LEFT JOIN FMM_LOCATION E ON C.LOCATION_KEY=E.LOCATION_KEY
                            WHERE CURRENT_QTY>0 ");
                if (!string.IsNullOrEmpty(model.OperationName))
                {
                    sbSql.AppendFormat(UtilHelper.BuilderWhereConditionString("C.OPERATION_NAME", model.OperationName.Split(',')));
                }

                if (!string.IsNullOrEmpty(model.StoreName))
                {
                    sbSql.AppendFormat(UtilHelper.BuilderWhereConditionString("C.STORE_NAME", model.StoreName.Split(',')));
                }

                if (!string.IsNullOrEmpty(model.MaterialCode))
                {
                    sbSql.AppendFormat(" AND D.MATERIAL_CODE  LIKE '{0}%'", model.MaterialCode.PreventSQLInjection());
                }
                if (!string.IsNullOrEmpty(model.MaterialLot))
                {
                    sbSql.AppendFormat(" AND A.MATERIAL_LOT  LIKE '{0}%'", model.MaterialLot.PreventSQLInjection());
                }
                if (!string.IsNullOrEmpty(model.RoomName))
                {
                    sbSql.AppendFormat(" AND E.LOCATION_NAME  LIKE '{0}%'", model.RoomName.PreventSQLInjection());
                }
                if (!string.IsNullOrEmpty(model.SupplierName))
                {
                    sbSql.AppendFormat(" AND A.MATERIAL_SUPPLIER  LIKE '{0}%'", model.SupplierName.PreventSQLInjection());
                }
                sbSql.AppendFormat(" AND A.STORE_MATERIAL_KEY = '{0}'", storeMaterialKey.PreventSQLInjection());
                dsReturn = this.db.ExecuteDataSet(CommandType.Text, sbSql.ToString());
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("SearchLotList Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #26
0
        public DataSet GetByFourParameters(string partId, string partType, string partModule, string partClass, ref PagingQueryConfig pconfig)
        {
            DataSet       dsReturn  = new DataSet();
            StringBuilder sqlCommon = new StringBuilder();

            try
            {
                sqlCommon.Append(@"SELECT PART_ID,PART_DESC,PART_TYPE,PART_MODULE,PART_CLASS,
	                                           (SELECT COUNT(1)
		                                        FROM  POR_PART_BYPRODUCT b
		                                        WHERE b.MAIN_PART_NUMBER=A.PART_ID
		                                        AND b.IS_USED='Y') AS TOTOL
                                        FROM dbo.POR_PART A WHERE 1=1 AND A.PART_STATUS = 1");
                if (!string.IsNullOrEmpty(partId))
                {
                    sqlCommon.AppendFormat(" AND PART_ID LIKE '{0}%'", partId);
                }
                if (!string.IsNullOrEmpty(partType))
                {
                    sqlCommon.AppendFormat(" AND PART_TYPE LIKE '{0}%'", partType);
                }
                if (!string.IsNullOrEmpty(partModule))
                {
                    sqlCommon.AppendFormat(" AND PART_MODULE LIKE '{0}%'", partModule);
                }
                if (!string.IsNullOrEmpty(partClass))
                {
                    sqlCommon.AppendFormat(" AND PART_CLASS LIKE '{0}%'", partClass);
                }
                int pages   = 0;
                int records = 0;
                AllCommonFunctions.CommonPagingData(sqlCommon.ToString(),
                                                    pconfig.PageNo,
                                                    pconfig.PageSize,
                                                    out pages,
                                                    out records,
                                                    db,
                                                    dsReturn,
                                                    "POR_PART",
                                                    "PART_ID ASC");
                pconfig.Pages   = pages;
                pconfig.Records = records;

                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetByFourParameters Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #27
0
        /// <summary>
        /// 获取当前工艺流程工步的下一工步。
        /// </summary>
        /// <remarks>
        /// 如果当前工步在当前工艺流程是最后一个工步但所属工艺流程组有下一工艺流程,则下一工步为下一工艺流程的第一个工步。
        /// </remarks>
        /// <param name="enterpriseKey">工艺流程组主键。</param>
        /// <param name="routeKey">ROUTE_ROUTE_VER_KEY(工艺流程主键)</param>
        /// <param name="stepKey">ROUTE_STEP_KEY(工步主键)。</param>
        /// <returns>包含下一工步数据的数据集对象。</returns>
        public DataSet GetEnterpriseNextRouteAndStep(string enterpriseKey, string routeKey, string stepKey)
        {
            DataSet dsReturn = new DataSet();

            try
            {
                if (string.IsNullOrEmpty(enterpriseKey) || string.IsNullOrEmpty(routeKey) || string.IsNullOrEmpty(stepKey))
                {
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, "传入参数为空,请检查。");
                    LogService.LogError(
                        string.Format(
                            "GetEnterpriseNextRouteAndStep Error: 传入参数为空,请检查。EnterpriseKey:{0};RouteKey:{1};StepKey:{2}。",
                            enterpriseKey, routeKey, stepKey)
                        );
                    return(dsReturn);
                }

                string sql = string.Format(@"WITH ROUTE AS
                                            (
                                                SELECT ROW_NUMBER() OVER (ORDER BY ROUTE_SEQ,ROUTE_STEP_SEQ) AS ROWNUMBER,
                                                        ROUTE_ENTERPRISE_VER_KEY,
                                                        ROUTE_ROUTE_VER_KEY,
                                                        ROUTE_STEP_KEY,
                                                        ENTERPRISE_NAME,
                                                        ROUTE_NAME,
                                                        ROUTE_STEP_NAME
                                                FROM V_PROCESS_PLAN 
                                                WHERE ROUTE_ENTERPRISE_VER_KEY='{0}'
                                            )
                                            SELECT ROUTE_ENTERPRISE_VER_KEY,ENTERPRISE_NAME,
	                                               ROUTE_ROUTE_VER_KEY,ROUTE_NAME,
	                                               ROUTE_STEP_KEY,ROUTE_STEP_NAME  
                                            FROM ROUTE a WHERE a.ROWNUMBER=1+(SELECT b.ROWNUMBER 
                                                                              FROM ROUTE b 
                                                                              WHERE b.ROUTE_ROUTE_VER_KEY='{1}'
                                                                              AND b.ROUTE_STEP_KEY='{2}')",
                                           enterpriseKey.PreventSQLInjection(),
                                           routeKey.PreventSQLInjection(),
                                           stepKey.PreventSQLInjection());

                dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                dsReturn.Tables[0].TableName = POR_ROUTE_STEP_FIELDS.DATABASE_TABLE_NAME;
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetEnterpriseNextRouteAndStep Error: " + ex.Message);
            }
            return(dsReturn);
        }
Пример #28
0
        /// <summary>
        /// 获取角色拥有的机台状态数据。
        /// </summary>
        /// <param name="roleKey">角色主键。</param>
        /// <param name="type">类型,是否拥有(SELECT:角色拥有,UNSELECT:角色不拥有。)</param>
        /// <returns>包含机台状态数据的数据集对象。</returns>
        public DataSet GetStatusOfRole(string roleKey, string type)//modify by qym 20120606
        {
            DataSet dsReturn = new DataSet();
            string  sql      = "";

            try
            {
                if (string.IsNullOrEmpty(roleKey) || string.IsNullOrEmpty(type))
                {
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, "输入参数为空");
                    return(dsReturn);
                }
                else
                {
                    if (type.ToUpper().Trim() == "SELECT")
                    {
                        sql = string.Format(@"SELECT EQUIPMENT_STATE_NAME
                                            FROM RBAC_ROLE_OWN_STATUS 
                                            WHERE ROLE_KEY='{0}'",
                                            roleKey.PreventSQLInjection());
                    }
                    else if (type.ToUpper().Trim() == "UNSELECT")
                    {
                        sql = string.Format(@"SELECT DISTINCT EQUIPMENT_STATE_NAME
                                            FROM EMS_EQUIPMENT_STATES
                                            WHERE  EQUIPMENT_STATE_NAME NOT IN(SELECT EQUIPMENT_STATE_NAME 
                                                                               FROM RBAC_ROLE_OWN_STATUS 
                                                                               WHERE ROLE_KEY='{0}')",
                                            roleKey.PreventSQLInjection());
                    }
                    else
                    {
                        ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Format("输入参数错误:{0}。", type));
                        return(dsReturn);
                    }
                    dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, "");
                }
            }
            catch (Exception ex)
            {
                LogService.LogError("GetStoreOfRole Error: " + ex.Message);
                FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
            }
            return(dsReturn);
        }
Пример #29
0
        /// <summary>
        /// 获取角色的用户数据。
        /// </summary>
        /// <param name="roleKey">角色主键。</param>
        /// <param name="type">类型,是否拥有(SELECT:角色拥有,UNSELECT:角色不拥有。)</param>
        /// <returns>包含用户数据的数据集对象。</returns>
        public DataSet GetUserOfRole(string roleKey, string type)
        {
            DataSet dsReturn = new DataSet();
            string  sql      = "";

            try
            {
                if (string.IsNullOrEmpty(roleKey) || string.IsNullOrEmpty(type))
                {
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, "输入参数为空");
                    return(dsReturn);
                }
                else
                {
                    if (type.ToUpper().Trim() == "SELECT")
                    {
                        sql = string.Format(@"SELECT 'False' AS COLUMN_CHECK,u.USERNAME,u.BADGE,u.USER_KEY
                                            FROM RBAC_USER_IN_ROLE t, RBAC_USER u
                                            WHERE t.USER_KEY = u.USER_KEY
                                            AND t.ROLE_KEY = '{0}'",
                                            roleKey.PreventSQLInjection());
                    }
                    else if (type.ToUpper().Trim() == "UNSELECT")
                    {
                        sql = string.Format(@"SELECT 'False' AS COLUMN_CHECK,a.USERNAME,a.BADGE, a.USER_KEY
                                            FROM RBAC_USER a
                                            WHERE a.USER_KEY NOT IN (SELECT t.USER_KEY FROM RBAC_USER_IN_ROLE t WHERE t.ROLE_KEY = '{0}')",
                                            roleKey.PreventSQLInjection());
                    }
                    else
                    {
                        ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Format("输入参数错误:{0}。", type));
                        return(dsReturn);
                    }
                    dsReturn = db.ExecuteDataSet(CommandType.Text, sql);
                    FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
                }
            }
            catch (Exception ex)
            {
                LogService.LogError("GetUserOfRole Error:" + ex.Message);
                FanHai.Hemera.Share.Common.ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
            }
            return(dsReturn);
        }
Пример #30
0
        public DataSet GetAllFab()
        {
            DataSet dsReturn = new DataSet();

            try
            {
                string sql = string.Format(@"select LOCATION_NAME from FMM_LOCATION where LOCATION_LEVEL=5");

                dsReturn = db.ExecuteDataSet(CommandType.Text, sql.ToString());
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, string.Empty);
            }
            catch (Exception ex)
            {
                ReturnMessageUtils.AddServerReturnMessage(dsReturn, ex.Message);
                LogService.LogError("GetAllFab Error: " + ex.Message);
            }
            return(dsReturn);
        }