예제 #1
0
        public int UpdateStorage_details(EntityStorage_details entity, SearchParameter sp)
        {   //设置更新库存表SQL语句
            string SqlStr = "";

            SqlStr  = "update tc_storage_details";
            SqlStr += " set storage_goods_code= '" + entity.Storage_goods_code.Trim();
            SqlStr += "' ,storage_count=" + entity.Storage_count + ",storage_inputdate='" + entity.Storage_inputdate + "',storage_maker_code= '" + entity.Storage_maker_code.Trim() + "',storage_count_name='" + entity.Storage_count_name.Trim() + "'";
            ArrayList arrayList = sp.Keys();

            switch (sp.GetHashTable[arrayList[0]].GetType().Name)
            {
            case "String":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;

            case "Int32":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[0].ToString()) + "";
                break;

            default:
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;
            }
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = SqlStr;
            //执行SQL语句
            ExcuteSql(sqlCommand);
            //返回操作成功结果
            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
        public int UpdateDisqualification_manage_NUM(EntityDisqualification entity, SearchParameter sp)
        {   //设置更新不合格产品临时表相关数量SQL语句
            string SqlStr = "";

            SqlStr  = "update tc_disqualification_manage ";
            SqlStr += " set deal_count = deal_count + " + entity.Deal_Count + ",undeal_count = undeal_count + " + entity.Undeal_Count + ",disqualification_count =  disqualification_count +" + entity.Disqualification_Count;
            ArrayList arrayList = sp.Keys();

            switch (sp.GetHashTable[arrayList[0]].GetType().Name)
            {
            case "String":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;

            case "Int32":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[0].ToString()) + "";
                break;

            default:
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;
            }
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = SqlStr;
            //执行SQL语句
            ExcuteSql(sqlCommand);
            //返回操作成功结果
            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
예제 #3
0
        public int DeleteRow(string tableName, SearchParameter sp)
        {
            string SqlStr = "";

            SqlStr = "DELETE  FROM " + tableName;

            ArrayList arrayList = sp.Keys();

            SqlCommand sqlCommand = new SqlCommand();

            for (int i = 0; i < arrayList.Count; i++)
            {
                if (i == 0)
                {
                    switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                    {
                    case "String":
                        SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;

                    case "Int32":
                        SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[i].ToString()) + "";
                        break;

                    default:
                        SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " = '%" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;
                    }
                }
                else
                {
                    switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                    {
                    case "String":
                        SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;

                    case "Int32":
                        SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " = " + sp.GetValue(arrayList[i].ToString()) + "";
                        break;

                    default:
                        SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " = '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;
                    }
                }
            }

            sqlCommand.CommandText = SqlStr;
            try
            {
                ExcuteSql(sqlCommand);
            }
            catch
            {
                return(Constants.SystemConfig.SERVER_ERROR);
            }

            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
예제 #4
0
        public int UpdateTemp_storage(EntityTemp_storage entity, SearchParameter sp)
        {   //设置更新库存表SQL语句
            string SqlStr = "";

            SqlStr  = "update tc_temp_storage";
            SqlStr += " set count= count +" + entity.Count + "";
            ArrayList arrayList = sp.Keys();

            switch (sp.GetHashTable[arrayList[0]].GetType().Name)
            {
            case "String":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;

            case "Int32":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[0].ToString()) + "";
                break;

            default:
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;
            }
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = SqlStr;
            //执行SQL语句
            ExcuteSql(sqlCommand);
            //返回操作成功结果
            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
예제 #5
0
        public int UpdateDisqualification_to(EntityDisqualification_To entity, SearchParameter sp)
        {   //设置更新不合格产品临时表SQL语句
            string SqlStr = "";

            SqlStr  = "update tc_disqualification_to ";
            SqlStr += " set disqualification_to_count =  " + entity.DISQUALIFICATION_TO_COUNT + ",deal_date = '" + entity.DEAL_DATE + "',deal_address =  '" + entity.DEAL_ADDRESS.Trim() + "',issued =  '" + entity.ISSUED.Trim() + "',reamark =  '" + entity.REAMARK.Trim() + "',deal_oper =  '" + entity.DEAL_OPER.Trim() + "'";
            ArrayList arrayList = sp.Keys();

            switch (sp.GetHashTable[arrayList[0]].GetType().Name)
            {
            case "String":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;

            case "Int32":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[0].ToString()) + "";
                break;

            default:
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;
            }
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = SqlStr;
            //执行SQL语句
            ExcuteSql(sqlCommand);
            //返回操作成功结果
            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
        public int UpdateInput_storageRow(EntityInput_storage entity, SearchParameter sp)
        {   //设置更新入库表SQL语句
            string SqlStr = "";

            SqlStr  = "update tc_input_storage";
            SqlStr += " set input_goods_code='" + entity.INPUT_GOODS_CODE.Trim() + "'";
            SqlStr += " ,input_quality_reg='" + entity.INPUT_QUALITY_REG.Trim() + "',input_batch_num='" + entity.INPUT_BATCH_NUM.Trim() + "',input_arrival_count= " + entity.INPUT_ARRIVAL_COUNT + ",input_standard_count= " + entity.INPUT_STANDARD_COUNT;
            SqlStr += " ,counter_name= '" + entity.COUNTER_NAME.Trim() + "',input_maketime='" + entity.INPUT_MAKETIME + "',input_check_persion='" + entity.INPUT_CHECK_PERSION.Trim() + "',supplier_name = '" + entity.SUPPLIER_NAME.Trim() + "";
            SqlStr += "',input_oper= '" + entity.INPUT_OPER.Trim() + "',input_quality_persion= '" + entity.INPUT_QUALITY_PERSION.Trim() + "',input_packing_in='" + entity.INPUT_PACKING_IN.Trim() + "',QUALITY_INFO = '" + entity.QUALITY_INFO.Trim() + "',check_info='" + entity.CHECK_INFO.Trim();
            SqlStr += "',input_packing_mid='" + entity.INPUT_PACKING_MID.Trim() + "',input_packing_out='" + entity.INPUT_PACKING_OUT.Trim() + "',input_issued= '" + entity.INPUT_ISSUED.Trim() + "' ,output_code= '" + entity.OUTPUT_CODE.Trim();
            SqlStr += "' ,input_remark='" + entity.INPUT_REMARK.Trim() + "',input_instorage_date='" + entity.INPUT_INSTORAGE_DATE + "',input_type='" + entity.INPUT_TYPE + "',operate_type='" + entity.OPERATE_TYPE + "',backstorage_date = ";
            if (entity.BACKSTORAGE_DATE.ToString("yyyyMMdd").Equals("00010101"))
            {
                SqlStr += "null";
            }
            else
            {
                SqlStr += "'" + entity.BACKSTORAGE_DATE + "'";
            }
            if (entity.INPUT_CHECKTIME.ToString("yyyyMMdd").Equals("00010101"))
            {
                SqlStr += ",input_checktime= " + "null";
            }
            else
            {
                SqlStr += ",input_checktime='" + entity.INPUT_CHECKTIME + "'";
            }
            ArrayList arrayList = sp.Keys();

            switch (sp.GetHashTable[arrayList[0]].GetType().Name)
            {
            case "String":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;

            case "Int32":
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[0].ToString()) + "";
                break;

            default:
                SqlStr += " where " + arrayList[0].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[0].ToString()) + "%'";
                break;
            }
            SqlCommand sqlCommand = new SqlCommand();

            sqlCommand.CommandText = SqlStr;
            //执行SQL语句
            ExcuteSql(sqlCommand);
            //返回操作成功结果
            return(Constants.SystemConfig.SERVER_SUCCESS);
        }
예제 #7
0
        public DataTable GetTableByDiyCondition(string sqlStr, SearchParameter sp)
        {
            dt = new DataTable();
            ArrayList  arrayList  = sp.Keys();
            SqlCommand sqlCommand = new SqlCommand();

            for (int i = 0; i < arrayList.Count; i++)
            {
                sqlStr = sqlStr.Replace(arrayList[i].ToString(), sp.GetValue(arrayList[i].ToString()).ToString());
            }

            sqlCommand.CommandText = sqlStr;

            GetDataTable(sqlCommand, dt);

            return(dt);
        }
예제 #8
0
        public DataTable GetSingleTableByCondition(string tableName, SearchParameter sp)
        {
            try
            {
                if (dt == null)
                {
                    dt = new DataTable();
                }
                string SqlStr = "";
                SqlStr = "SELECT * FROM " + tableName;
                ArrayList  arrayList  = sp.Keys();
                SqlCommand sqlCommand = new SqlCommand();

                for (int i = 0; i < arrayList.Count; i++)
                {
                    if (i == 0)
                    {
                        switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                        {
                        case "String":
                            SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " like '%" + sp.GetValue(arrayList[i].ToString()) + "%'";
                            break;

                        case "Int32":
                            SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[i].ToString()) + "";
                            break;

                        case "DateTime":
                            if (arrayList[i].ToString().Trim().ToUpper().Contains("_FROM"))
                            {
                                SqlStr += " where " + arrayList[i].ToString().Replace(":", "").Replace("_FROM", "") + ">= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                            }
                            else if (arrayList[i].ToString().Trim().ToUpper().Contains("_TO"))
                            {
                                SqlStr += " where " + arrayList[i].ToString().Replace(":", "").Replace("_TO", "") + "<= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                            }
                            break;

                        default:
                            SqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " like '%" + sp.GetValue(arrayList[i].ToString()) + "%'";
                            break;
                        }
                    }
                    else
                    {
                        switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                        {
                        case "String":
                            SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " like '%" + sp.GetValue(arrayList[i].ToString()) + "%'";
                            break;

                        case "Int32":
                            SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " = " + sp.GetValue(arrayList[i].ToString()) + "";
                            break;

                        case "DateTime":
                            if (arrayList[i].ToString().Trim().ToUpper().Contains("_FROM"))
                            {
                                SqlStr += " and " + arrayList[i].ToString().Replace(":", "").Replace("_FROM", "") + ">= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                            }
                            else if (arrayList[i].ToString().Trim().ToUpper().Contains("_TO"))
                            {
                                SqlStr += " and " + arrayList[i].ToString().Replace(":", "").Replace("_TO", "") + "<= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                            }
                            break;

                        default:
                            SqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " like '%" + sp.GetValue(arrayList[i].ToString()) + "%'";
                            break;
                        }
                    }
                }

                sqlCommand.CommandText = SqlStr;

                GetDataTable(sqlCommand, dt);

                return(dt);
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                connection.Close();
            }
        }
예제 #9
0
        public DataTable GetTableBySqlStrUnLike(string sqlStr, SearchParameter sp)
        {
            dt = new DataTable();
            ArrayList  arrayList  = sp.Keys();
            SqlCommand sqlCommand = new SqlCommand();

            for (int i = 0; i < arrayList.Count; i++)
            {
                if (i == 0)
                {
                    switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                    {
                    case "String":
                        sqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;

                    case "Int32":
                        sqlStr += " where " + arrayList[i].ToString().Replace(":", "") + "= " + sp.GetValue(arrayList[i].ToString()) + "";
                        break;

                    case "DateTime":
                        if (arrayList[i].ToString().Trim().ToUpper().Contains("_FROM"))
                        {
                            sqlStr += " where " + arrayList[i].ToString().Replace(":", "").Replace("_FROM", "") + ">= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        }
                        else if (arrayList[i].ToString().Trim().ToUpper().Contains("_TO"))
                        {
                            sqlStr += " where " + arrayList[i].ToString().Replace(":", "").Replace("_TO", "") + "<= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        }
                        break;

                    default:
                        sqlStr += " where " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;
                    }
                }
                else
                {
                    switch (sp.GetHashTable[arrayList[i]].GetType().Name)
                    {
                    case "String":
                        sqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;

                    case "Int32":
                        sqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " = " + sp.GetValue(arrayList[i].ToString()) + "";
                        break;

                    case "DateTime":
                        if (arrayList[i].ToString().Trim().ToUpper().Contains("_FROM"))
                        {
                            sqlStr += " and " + arrayList[i].ToString().Replace(":", "").Replace("_FROM", "") + ">= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        }
                        else if (arrayList[i].ToString().Trim().ToUpper().Contains("_TO"))
                        {
                            sqlStr += " and " + arrayList[i].ToString().Replace(":", "").Replace("_TO", "") + "<= '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        }
                        break;

                    default:
                        sqlStr += " and " + arrayList[i].ToString().Replace(":", "") + " like '" + sp.GetValue(arrayList[i].ToString()) + "'";
                        break;
                    }
                }
            }

            sqlCommand.CommandText = sqlStr;

            GetDataTable(sqlCommand, dt);

            return(dt);
        }